Hello,

On Thu, 19 Jun 2025 19:36:04 +0900,
Benjamin Berg wrote:

> > +void arch_switch_to(struct task_struct *to)
> > +{
> > +   /*
> > +    * In !CONFIG_MMU, it doesn't ptrace thus,
> > +    * The FS_BASE/GS_BASE registers are saved here.
> > +    */
> > +   current_top_of_stack = task_top_of_stack(to);
> > +   current_ptregs = (long)task_pt_regs(to);
> > +
> > +   if ((to->thread.regs.regs.gp[FS_BASE / sizeof(unsigned long)] == 0) ||
> > +       (to->mm == NULL))
> > +           return;
> > +
> > +   /* this changes the FS on every context switch */
> > +   arch_prctl(to, ARCH_SET_FS,
> > +              (void __user *) to->thread.regs.regs.gp[FS_BASE / 
> > sizeof(unsigned long)]);
> 
> Hmm,  the comment mentions FS_BASE/GS_BASE, but here you only handle
> FS_BASE? Is that intentional?

thanks for the comment.

my intention is only specific to fs_base as I saw the register needs
to restore during this switch while with gs_base I didn't.  I can
update it if I see a real issue without it.

The comment needs to be updated (I guess this is copied/pasted from
the original arch_switch_to comment).

-- Hajime

Reply via email to