summaryrefslogtreecommitdiff
path: root/tools/objtool
diff options
context:
space:
mode:
authorPuranjay Mohan <puranjay@kernel.org>2026-09-16 11:43:19 -0700
committerIngo Molnar <mingo@kernel.org>2026-09-21 11:05:41 +0200
commit1ecf11530c16252dca835c9bc9133f73f5225ee4 (patch)
tree64791c5e5add88f841581a5eec76579c3c319491 /tools/objtool
parent050a0c53a6c6009be329c7034d7a4d22ea146b12 (diff)
objtool/klp: Add test for unchecksummed input
klp diff decides what changed by comparing the per-function checksums klp checksum records in .discard.sym_checksum. Handed an object which was never checksummed it has to say so; silently concluding that nothing changed would be the worst available answer. Signed-off-by: Puranjay Mohan <puranjay@kernel.org> Signed-off-by: Song Liu <song@kernel.org> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Assisted-by: Claude:claude-opus-5 Link: https://patch.msgid.link/20260916184351.2720310-27-song@kernel.org
Diffstat (limited to 'tools/objtool')
-rwxr-xr-xtools/objtool/tests/generic/test-missing-checksum.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/objtool/tests/generic/test-missing-checksum.sh b/tools/objtool/tests/generic/test-missing-checksum.sh
new file mode 100755
index 000000000000..89a05b1869ed
--- /dev/null
+++ b/tools/objtool/tests/generic/test-missing-checksum.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+#
+# Without .discard.sym_checksum there is nothing to compare; concluding that
+# nothing changed would be worse than failing.
+
+. "$(dirname "$0")/../lib.sh"
+
+setup
+build_pair basic.c
+
+( cd "$workdir" && "$OBJTOOL" klp diff orig.o patched.o out.o ) \
+ > "$workdir/diff.log" 2>&1 && fail "klp diff accepted an unchecksummed object"
+
+grep -q 'sym_checksum' "$workdir/diff.log" ||
+ fail "expected a complaint about the checksum section, got: $(tail -1 "$workdir/diff.log")"
+
+pass "unchecksummed input rejected"