Re: [PATCH 10/9] x86/fpu: Fix 'struct fpu' misalignment on 32-bit kernels

From: Oleg Nesterov
Date: Fri Jun 14 2024 - 11:19:23 EST


Hi Ingo, sorry for delay.

On 06/13, Ingo Molnar wrote:
>
> > --- a/include/linux/sched.h
> > +++ b/include/linux/sched.h
> > @@ -1562,7 +1562,7 @@ struct task_struct {
> > * they are included in the randomized portion of task_struct.
> > */
> > randomized_struct_fields_end
> > -};
> > +} __attribute__ ((aligned (64)));

I guess __aligned(64) will look a bit better, but this is minor.

> What happened is that due to my series 'struct task_struct' lost its
> 64-byte alignment attribute, which broke the fpu struct allocation code on
> 32-bit kernels and made the 64-bit one probably unrobust as well.

Yes, and note that struct fpstate has the same __aligned(64), that is
how I noticed the potential problem and decided to check.

But Ingo, it was a shot in the dark ;) I still don't really understand
what exactly should be aligned. Is it the fpstate->regs member? Or what?
If yes, perhaps this member needs __aligned(64) too to be safe?

> ... and would appreciate your Acked-by or Reviewed-by for the eventual
> final version of the series, but I don't insist. ;-)

Thanks ;) will do.

Oleg.