Re: [PATCH 2/2] s390/fpu: make use of __uninitialized macro

From: Heiko Carstens
Date: Mon Feb 05 2024 - 11:36:49 EST


On Mon, Feb 05, 2024 at 08:26:32AM -0800, Kees Cook wrote:
> > +#define DECLARE_KERNEL_FPU_ONSTACK(name) \
> > + struct kernel_fpu name __uninitialized
>
> Are there cases when struct kernel_fpu should be initialized? e.g.
> should the attribute just be added to the struct definition instead of
> marking each use?

I tried that, but failed:

/arch/s390/include/asm/fpu/types.h:36:3: warning: '__uninitialized__' attribute only applies to local variables [-Wignored-attributes]
36 | } __uninitialized;
| ^
/include/linux/compiler_attributes.h:343:42: note: expanded from macro '__uninitialized'
343 | # define __uninitialized __attribute__((__uninitialized__))
| ^

That's why I came up with this macro. I'd prefer to have this added only to
the struct definition, but looks like this is not possible (or I just can't
figure out who to do that).