UPSTREAM: lib/test_stackinit: Handle Clang auto-initialization pattern

Upstream commit 8c30d32b1a32 ("lib/test_stackinit: Handle Clang
auto-initialization pattern").

While the gcc plugin for automatic stack variable initialization (i.e.
CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL) performs initialization with
0x00 bytes, the Clang automatic stack variable initialization (i.e.
CONFIG_INIT_STACK_ALL) uses various type-specific patterns that are
typically 0xAA. Therefore the stackinit selftest has been fixed to check
that bytes are no longer the test fill pattern of 0xFF (instead of looking
for bytes that have become 0x00). This retains the test coverage for the
0x00 pattern of the gcc plugin while adding coverage for the mostly 0xAA
pattern of Clang.

Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Bug: 144999193
Change-Id: Ieb59dd5ba351d9ae96e5e3ad22f686be4524281a
Signed-off-by: Alexander Potapenko <glider@google.com>
1 file changed