summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/libxed.py
diff options
context:
space:
mode:
authorSong Liu <song@kernel.org>2026-09-16 11:43:44 -0700
committerIngo Molnar <mingo@kernel.org>2026-09-21 11:12:07 +0200
commit065f09c8332f9d5cf6ee5cd2494b9af179ee749b (patch)
tree14803b04d469466a1b2dd4bdf90447de49c2a156 /tools/perf/scripts/python/libxed.py
parent938816b7d15644a486ebcea5d58994664b8cc04c (diff)
objtool/klp: Add test for instruction operand checksums
checksum_update_insn() hashes an instruction's bytes and then what any relocation on it refers to: a string section contributes the string's contents, anything else the target symbol's name and adjusted addend, with a reference to a static resolved through its section symbol first. None of that shows up in the bytes. A rel32 operand is zero in the object and supplied by the relocation, so calling a different function, editing a literal the code passes, or reading a different index of an array all leave the encoded instruction byte-identical. A checksum stopping at the bytes reports the function unchanged and the patch silently does not contain the fix. test-checksum-position is the other half: what must *not* change the checksum when a function merely moves. Each of the four is verified by sabotaging the line it covers. The static case needed a writer the compiler cannot see through -- without one it proves the array is never written, folds every read to zero, and emits no relocation at all, so the reference under test does not exist and the variant passes having compared two identical objects. 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-52-song@kernel.org
Diffstat (limited to 'tools/perf/scripts/python/libxed.py')
0 files changed, 0 insertions, 0 deletions