On Thu, Feb 14, 2019 at 2:34 PM Peter Zijlstra <pet...@infradead.org> wrote: > > On Thu, Feb 14, 2019 at 11:18:01AM -0500, Brian Gerst wrote: > > > > --- a/arch/x86/include/asm/switch_to.h > > > +++ b/arch/x86/include/asm/switch_to.h > > > @@ -40,6 +40,7 @@ asmlinkage void ret_from_fork(void); > > > * order of the fields must match the code in __switch_to_asm(). > > > */ > > > struct inactive_task_frame { > > > + unsigned long flags; > > > #ifdef CONFIG_X86_64 > > > unsigned long r15; > > > unsigned long r14; > > > > flags should be initialized in copy_thread_tls(). I think the new > > stack is zeroed already, but it would be better to explicitly set it. > > Ah indeed. I somehow misread that code and thought we got initialized > with a copy of current. > > Something like the below, right? > > --- > > --- a/arch/x86/kernel/process_32.c > +++ b/arch/x86/kernel/process_32.c > @@ -127,6 +127,7 @@ int copy_thread_tls(unsigned long clone_ > struct task_struct *tsk; > int err; > > + frame->flags = 0; > frame->bp = 0; > frame->ret_addr = (unsigned long) ret_from_fork; > p->thread.sp = (unsigned long) fork_frame; > --- a/arch/x86/kernel/process_64.c > +++ b/arch/x86/kernel/process_64.c > @@ -392,6 +392,7 @@ int copy_thread_tls(unsigned long clone_ > childregs = task_pt_regs(p); > fork_frame = container_of(childregs, struct fork_frame, regs); > frame = &fork_frame->frame; > + frame->flags = 0; > frame->bp = 0; > frame->ret_addr = (unsigned long) ret_from_fork; > p->thread.sp = (unsigned long) fork_frame;
Yes, this looks good. -- Brian Gerst