]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
kunit/stackinit: Use fill byte different from Clang i386 pattern
authorKees Cook <kees@kernel.org>
Tue, 4 Mar 2025 22:56:11 +0000 (14:56 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Apr 2025 12:39:11 +0000 (14:39 +0200)
commitb471631fa19af227d4bcc95c8c3372ff8f34476f
treed5c0d8cab127f522306a74cee195ef21da644775
parentff435a627342fd98feedcf58bbc01f904bbac146
kunit/stackinit: Use fill byte different from Clang i386 pattern

[ Upstream commit d985e4399adffb58e10b38dbb5479ef29d53cde6 ]

The byte initialization values used with -ftrivial-auto-var-init=pattern
(CONFIG_INIT_STACK_ALL_PATTERN=y) depends on the compiler, architecture,
and byte position relative to struct member types. On i386 with Clang,
this includes the 0xFF value, which means it looks like nothing changes
between the leaf byte filling pass and the expected "stack wiping"
pass of the stackinit test.

Use the byte fill value of 0x99 instead, fixing the test for i386 Clang
builds.

Reported-by: ernsteiswuerfel
Closes: https://github.com/ClangBuiltLinux/linux/issues/2071
Fixes: 8c30d32b1a32 ("lib/test_stackinit: Handle Clang auto-initialization pattern")
Tested-by: Nathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/20250304225606.work.030-kees@kernel.org
Signed-off-by: Kees Cook <kees@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
lib/stackinit_kunit.c