Hi,

It seems that I found a bug in the latest version of L4Android kernel. I'm familiar enough with the code base so your comments are highly appreciated.

The main thread for L4Linux (i.e., the thread running l4x_server_loop()) didn't initialize l4x_stack before execution. Therefore, this thread crashes whenever it calls cli() / sti().

Calling vmalloc() and kmalloc() can reproduce this bug reliably. Here is a patch to fix this problem.

~Haohui

--- a/arch/l4/kernel/main.c
+++ b/arch/l4/kernel/main.c
@@ -2501,6 +2501,8 @@ int __init_refok L4_CV main(int argc, char **argv)
         * for these areas so far */
        //l4x_register_pointer_section(&_edata, 0, "data");
 
+       l4x_stack_setup(current_thread_info(), l4_utcb(), 0);
+
        /* Send start message to main thread. */
        l4_ipc_send(l4lx_thread_get_cap(main_id),
                    l4_utcb(), l4_msgtag(0, 0, 0, 0), L4_IPC_NEVER);