On Thu, 2025-06-19 at 21:22 +0900, Hajime Tazaki wrote: > > 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 ?
Oh, I am just being annoyed by libc in general in UM. It isn't specific to this patchset. An example is that we need to keep malloc() working for libc. Which I would think is kind of weird. Or we had issues because libc turned on rseq and that was inherited into userspace, causing random crashes and such. > > 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. OK, need to look at that again a bit. I haven't really wrapped my mind around how everything fits together, so I probably got some stuff wrong. Benjamin