简体   繁体   中英

How does the user-mode kernel in UML interface with the underlying kernel on the host

In user mode linux (UML) a trace thread annuls system calls made by the user-space process and redirects them to a kernel running in user-space. Now at some point this userspace kernel would require assistance of the host OS. How does the user-mode kernel call the underlying host kernel, Is it just normal system calls? Or does it use some kind of IOCTL mechanism or something else?

I found an very simple explanation of UML design here . It may be useful for you.

UML constructs it using ptrace system call tracing mechanism.

  1. When a process in user space, its system called are intercepted by ptrace.
  2. When it is in the kernel, no interception. When a process executes a system call or receives signal, the tracing thread forces the process to run in the kernel.
  3. After the transition, the process state is restored and it continues.

System call virtualization

  1. By switching the user and kernel and system calls interception
  2. Note: the system call must be annulled in the host kernel.
  3. The process state is preserved.
  4. When the system call is complete, the process obtains the returned value in its saved registers and returned to user mode.

Also, this article explains System call virtualization using ptrace with the following picture.

http://www.csee.wvu.edu/~katta/uml/graphics/vsyscall.jpg . The red line represents the normal syscall procedure.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM