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)
committerKees Cook <kees@kernel.org>
Thu, 6 Mar 2025 06:04:55 +0000 (22:04 -0800)
commitd985e4399adffb58e10b38dbb5479ef29d53cde6
tree55ca9d87d0a695930b2fef63146c1b01d46c1b89
parent04e403e6627d8513d14f3236e52068837eabd2a5
kunit/stackinit: Use fill byte different from Clang i386 pattern

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>
lib/tests/stackinit_kunit.c