diff options
| author | Song Liu <song@kernel.org> | 2026-09-16 11:43:50 -0700 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2026-09-21 11:12:08 +0200 |
| commit | 317cf7bbfa3de0fb61451e9b0b11d20831fb9f9a (patch) | |
| tree | 0692a1eae7d2a656a1f4d7aaa3d7f959f0153553 /tools/perf/scripts/python/stackcollapse.py | |
| parent | 41ca5150dd816f856c545775525013513e9a31fa (diff) | |
| download | linux-317cf7bbfa3de0fb61451e9b0b11d20831fb9f9a.tar.gz linux-317cf7bbfa3de0fb61451e9b0b11d20831fb9f9a.zip | |
objtool/klp: Add test for Clang switch jump tables
For a dense enough switch Clang emits the targets as a table in
.rodata..Lswitch.table.<function> -- named after the function but not part
of it. The patched function indexes into that table, so a clone which does
not bring it along jumps through whatever the kernel's copy holds, which
after a patch that changed the switch is the wrong set of targets. An
indirect jump to a stale address reports nothing at build or load time.
The fixture asserts its own premise twice over, since both halves depend on
what this Clang chose to do: that a table was built rather than a chain of
comparisons, and that the added case actually changed it.
objtool has no switch-specific code -- the table is carried by the general
mechanism for data a cloned function references -- so this guards that
mechanism reaching an easily-mishandled shape rather than a particular
line, and the test says so. Making the table uncorrelated, the nearest
available sabotage, does not change the outcome.
Assisted-by: Claude:claude-opus-4
Based-on-test-by: Joe Lawrence <joe.lawrence@redhat.com>
Assisted-by: Claude:claude-opus-5
Signed-off-by: Song Liu <song@kernel.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://patch.msgid.link/20260916184351.2720310-58-song@kernel.org
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions
