Re: [PATCH 1/2] x86/boot/startup: Disable kernel stack depth tracking

From: Nick Desaulniers

Date: Thu Nov 19 2026 - 17:30:44 EST


On Thu, Nov 19, 2026 at 1:31 PM Usama Arif <usama.arif@xxxxxxxxx> wrote:
>
> Commit 57fbad15c2ee ("stackleak: Rename STACKLEAK to KSTACK_ERASE")
> renamed DISABLE_STACKLEAK_PLUGIN to DISABLE_KSTACK_ERASE everywhere
> except in arch/x86/boot/startup/Makefile. The old name now expands to
> nothing, so the startup code is built with stack depth tracking enabled.
>
> The startup code is linked with every symbol prefixed by __pi_, so that
> it cannot call into the rest of the kernel by accident. It has no alias
> for the tracking callback, and tracking stack depth there is of no use.
>
> At the default KSTACK_ERASE_TRACK_MIN_SIZE of 100 no startup function is
> large enough to be tracked, so this went unnoticed. With Clang,
> CONFIG_AMD_MEM_ENCRYPT=y and a minimum below about 90 bytes,
> pvalidate_4k_page(), snp_cpuid() and do_vc_no_ghcb() get a call to
> __sanitizer_cov_stack_depth() and vmlinux fails to link:
>
> ld.lld: error: undefined symbol: __pi___sanitizer_cov_stack_depth
>
> Use DISABLE_KSTACK_ERASE, which disables tracking with either compiler.
>
> Fixes: 57fbad15c2ee ("stackleak: Rename STACKLEAK to KSTACK_ERASE")

tsk tsk, Kees your `grep` might be borked!
Reviewed-by: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>

> Signed-off-by: Usama Arif <usama.arif@xxxxxxxxx>
> ---
> arch/x86/boot/startup/Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/boot/startup/Makefile b/arch/x86/boot/startup/Makefile
> index 5e499cfb29b5c0..0815105e7205c7 100644
> --- a/arch/x86/boot/startup/Makefile
> +++ b/arch/x86/boot/startup/Makefile
> @@ -3,7 +3,7 @@
> KBUILD_AFLAGS += -D__DISABLE_EXPORTS
> KBUILD_CFLAGS += -D__DISABLE_EXPORTS -mcmodel=small -fPIC \
> -Os -DDISABLE_BRANCH_PROFILING \
> - $(DISABLE_STACKLEAK_PLUGIN) \
> + $(DISABLE_KSTACK_ERASE) \
> $(DISABLE_LATENT_ENTROPY_PLUGIN) \
> -fno-stack-protector -D__NO_FORTIFY \
> -fno-jump-tables \
> --
> 2.53.1-Meta
>


--
Thanks,
~Nick Desaulniers