>But when I traced the > call_usermodehelper() function, I found that the kernel thread use > kernel_thread() function to create another kernel > thread, and then the new kernel thread execute execve() function to > load the executable program of the user process. Why can it do this? > Can it access the user space? maybe what you saw was sys_execve (or do_execve?) ? In that case, no need to access user space since those functions are on kernel space (mapped on address larger than PAGE_OFFSET)
Thanks in advance! Yes, it is sys_execve() in deed. Since the mm struct of kernel thread is borrowed, where we get the user thread's mm struct? Duplicate the borrowed mm struct? My another question is how kernel thread switch to user thread? Is the sys_execve() construct the user mode registers? Regards, Cheng -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/