[RFC PATCH 07/13] um: nommu: configure fs register on host syscall invocation
Hajime Tazaki
thehajime at gmail.com
Fri Oct 25 06:27:24 PDT 2024
On Fri, 25 Oct 2024 18:28:01 +0900,
Johannes Berg wrote:
>
> On Thu, 2024-10-24 at 21:09 +0900, Hajime Tazaki wrote:
> >
> > +static void sigill(int sig, siginfo_t *si, void *ctx_void)
> > +{
> > + longjmp(jmpbuf, 1);
> > +}
>
> Should this code use sigsetjmp/siglongjmp?
the code is referred from tools/testing/selftests/x86/fsgsbase.c and
the original code uses sigsetjmp/siglongjmp indeed.
I was struggling to pull the definition of sigsetjmp & co from host
headers as it conflicts with UML definitions of jmp_buf, etc.
Will look into detail again but would be nice if you have an
experience on this.
> > +int os_has_fsgsbase(void)
> > +{
> > + return has_fsgsbase;
> > +}
>
> Why should this be a function rather than just exposing the variable?
as it is referred in arch/x86/um code.
> > +++ b/arch/um/os-Linux/time.c
> > @@ -89,7 +89,8 @@ long long os_nsecs(void)
> > {
> > struct timespec ts;
> >
> > - clock_gettime(CLOCK_MONOTONIC,&ts);
> > + clock_gettime(CLOCK_MONOTONIC, &ts);
> > +
> > return timespec_to_ns(&ts);
>
> unrelated changes
will revert it.
> > #ifndef CONFIG_MMU
> >
> > +static int os_x86_arch_prctl(int pid, int option, unsigned long *arg2)
> > +{
> > + if (os_has_fsgsbase()) {
> > + switch (option) {
> > + case ARCH_SET_FS:
> > + wrfsbase(*arg2);
> > + break;
> > + case ARCH_SET_GS:
> > + wrgsbase(*arg2);
> > + break;
> > + case ARCH_GET_FS:
> > + *arg2 = rdfsbase();
> > + break;
> > + case ARCH_GET_GS:
> > + *arg2 = rdgsbase();
> > + break;
> > + }
> > + return 0;
> > + } else
> > + return os_arch_prctl(pid, option, arg2);
>
> please use (or don't) {} on all branches
thanks, will fix it.
> > @@ -39,4 +73,5 @@ __visible void do_syscall_64(struct pt_regs *regs)
> > current_thread_info()->aux_fp_regs);
> > }
> > }
> > +
> > #endif
>
> unrelated
will revert it too.
-- Hajime
More information about the linux-um
mailing list