Re: [PATCH 1/2] Compiler Attributes: Add __uninitialized macro

Kees Cook
2024-02-05T16:21:49Z

On Mon, Feb 05, 2024 at 04:48:43PM +0100, Heiko Carstens wrote:
> With INIT_STACK_ALL_PATTERN or INIT_STACK_ALL_ZERO enabled the kernel will
> be compiled with -ftrivial-auto-var-init=<...> which causes initialization
> of stack variables at function entry time.
>
> In order to avoid the performance impact that comes with this users can use
> the "uninitialized" attribute to prevent such initialization.
>
> Therefore provide the __uninitialized macro which can be used for cases
> where INIT_STACK_ALL_PATTERN or INIT_STACK_ALL_ZERO is enabled, but only
> selected variables should not be initialized.
>
> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>

Thanks! We had something similar a while back with syscall entry:
efa90c11f62e ("stack: Constrain and fix stack offset randomization with Clang builds")

Acked-by: Kees Cook <keescook@chromium.org>

--
Kees Cook