Damien Zammit, le ven. 02 janv. 2026 04:16:11 +0000, a ecrit:
> ---
>  i386/i386/pcb.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/i386/i386/pcb.c b/i386/i386/pcb.c
> index 21f9e06a..7098bf33 100644
> --- a/i386/i386/pcb.c
> +++ b/i386/i386/pcb.c
> @@ -230,7 +230,9 @@ void switch_ktss(pcb_t pcb)
>  
>  #if defined(__x86_64__) && !defined(USER32)
>       wrmsr(MSR_REG_FSBASE, pcb->ims.sbs.fsbase);
> -     wrmsr(MSR_REG_GSBASE, pcb->ims.sbs.gsbase);
> +     /* Dont load zero into gs base, could be a kernel thread */
> +     if (pcb->ims.sbs.gsbase != 0)
> +             wrmsr(MSR_REG_GSBASE, pcb->ims.sbs.gsbase);

Well this shows that we are getting messy: sometimes we have gs with the
uesrland value, sometimes we have it with the kernel value, and it'll be
hard to keep it correct, as patch9 shows.

We should *really* rather correctly set gs on kernel/user switch using
swapgs otherwise we'll have headaches. It shouldn't be very hard, it'll
be just along other segment loads in SET_KERNEL_SEGMENTS.

Samuel

Reply via email to