Re: How does kernel thread create user process?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Cheng...

> As we know, the kernel thread has no user space, so it can't access
> the user mode linear addresses. 

Actually, it can :) It borrows the user space part (task_struct->mm) of 
the last scheduled process. But since you can not predict which "mm" 
struct it will borrow, it is not recommended to do so.....however, this 
doesn't mean you absolutely can't :)

>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)

regards,

Mulyadi


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux