Hi !
But the task_struct{}'s mm field of kernel thread is NULL. In another word, kernel thread has no user space address. However a user thread must have the user space addresses, so where the mm struct of the user thread comes from when a kernel thread becomes a user thread? I didn't find the code from call_usermodehelper() function.
are you looking for this: http://lxr.free-electrons.com/source/kernel/fork.c#511 ? you can see here that if we are calling not from process context, we will have no mm struct (as you said), therefore the process creation will fail... (call_usermodehelper eventually reach do_fork, which calls copy_mm()) HTH. if not please say :) Ohad.
Thanks in advance! Regards, Cheng
-- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/