diff options
| author | Justin Stitt <justinstitt@google.com> | 2026-10-02 12:12:53 -0700 |
|---|---|---|
| committer | Kees Cook <kees@kernel.org> | 2026-10-05 02:19:01 -0700 |
| commit | 6bf37b9c59dc8e7a765a5c7c4ff01ccf8106b122 (patch) | |
| tree | 05beb918557ce77a600dc81810b3c52f5c3edafc /tools/perf/python/stackcollapse.py | |
| parent | 633c60a2e87345bd70ced5a28561991fa5b0b1f3 (diff) | |
| download | linux-next-6bf37b9c59dc8e7a765a5c7c4ff01ccf8106b122.tar.gz linux-next-6bf37b9c59dc8e7a765a5c7c4ff01ccf8106b122.zip | |
kunit/stackinit: Cover declarations bypassed by goto and switch
Under -ftrivial-auto-var-init= the initialization is emitted where a
variable is declared. A switch dispatch that reaches a case label below
the declaration, or a goto that jumps past it, never reaches that point,
so the variable was left uninitialized.
Commit 9cf016e6b49b ("lib: test_stackinit.c: XFAIL switch variable init
tests") marked test_switch_1_none and test_switch_2_none as expected
failures, noting the test should be retained "so that we can evaluate
compiler fixes". Clang 24 emits the initialization on the jumps that
bypass the declaration, so make the expectation depend on the compiler
version instead of failing unconditionally.
Add test_goto_none as well. The existing cases only cover a declaration
sitting between a switch and its first case label, while the compiler
change covers plain goto too.
GCC continues to initialize only at the declaration, and reports as much
with -Wtrivial-auto-var-init, so it keeps the expected-failure path.
Link: https://github.com/llvm/llvm-project/pull/181937
Link: https://github.com/KSPP/linux/issues/125
Link: https://llvm.org/pr44916
Assisted-by: LLM
Signed-off-by: Justin Stitt <justinstitt@google.com>
Link: https://patch.msgid.link/20261002-kspp-125-v1-1-91286a454fda@google.com
Signed-off-by: Kees Cook <kees@kernel.org>
Diffstat (limited to 'tools/perf/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions
