[PATCH v9 07/13] um: nommu: configure fs register on host syscall invocation

Hajime Tazaki thehajime at gmail.com
Thu Jun 19 05:22:48 PDT 2025


On Thu, 19 Jun 2025 19:40:49 +0900,
Benjamin Berg wrote:
> 
> On Thu, 2025-06-19 at 10:04 +0900, Hajime Tazaki wrote:
> > As userspace on UML/!MMU also need to configure %fs register when it is
> > running to correctly access thread structure, host syscalls implemented
> > in os-Linux drivers may be puzzled when they are called.  Thus it has to
> > configure %fs register via arch_prctl(SET_FS) on every host syscalls.
> 
> Really, I still think that we should "just" get rid of libc entirely
> inside UML. That would avoid so many weird/potential issues …

I'm not sure if I understand your point.

Q1) what do you mean by 'get rid of libc entirely' here ?
    do you mean the following code block adds the dependency ?
+ int os_arch_prctl(int pid, int option, unsigned long *arg2)
+ {
+ 	return syscall(SYS_arch_prctl, option, arg2);
+ }

I guess this can be replaced with inline assembly instead of using
libc's one.  but this is the code under os-Linux, which I thought we're
allowed to use the host code ?

Q2) "That would avoid so many weird/potential issues …"
I'm new to this;  I'm wondering what kind of issues did you see ?

> Doesn't change the fact that FS/GS needs to be restored when doing
> thread switches and such. Though one might be able to do it entirely
> within arch_switch_to then.

I believe this is already done in arch_switch_to.  This particular
patch does the control to the host context.

-- Hajime



More information about the linux-um mailing list