summaryrefslogtreecommitdiff
path: root/lib/overflow_kunit.c
diff options
context:
space:
mode:
authorKees Cook <kees@kernel.org>2025-01-27 22:10:27 +0300
committerKees Cook <kees@kernel.org>2025-01-30 19:48:28 +0300
commite71a29db79da194678630ebfcc53ff2aecc9d441 (patch)
treeb8be8a9a4184e46d33ace117a83bef853b6a3f8f /lib/overflow_kunit.c
parentad9f265c7328d9d73a9d1edbd52f4415cc764296 (diff)
downloadlinux-e71a29db79da194678630ebfcc53ff2aecc9d441.tar.xz
stackinit: Add union initialization to selftests
The stack initialization selftests were checking scalars, strings, and structs, but not unions. Add union tests (which are mostly identical setup to structs). This catches the recent union initialization behavioral changes seen in GCC 15. Before GCC 15, this new test passes: ok 18 test_small_start_old_zero With GCC 15, it fails: not ok 18 test_small_start_old_zero Specifically, a union with a larger member where a smaller member is initialized with the older "= { 0 }" syntax: union test_small_start { char one:1; char two; short three; unsigned long four; struct big_struct { unsigned long array[8]; } big; }; This is a regression in compiler behavior that Linux has depended on. GCC does not seem likely to fix it, instead suggesting that affected projects start using -fzero-init-padding-bits=unions: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118403 Link: https://lore.kernel.org/r/20250127191031.245214-2-kees@kernel.org Signed-off-by: Kees Cook <kees@kernel.org>
Diffstat (limited to 'lib/overflow_kunit.c')
0 files changed, 0 insertions, 0 deletions