[tip: objtool/core] objtool/klp: Add test for unchecksummed input
From: tip-bot2 for Puranjay Mohan
Date: Fri Sep 18 2026 - 06:55:37 EST
The following commit has been merged into the objtool/core branch of tip:
Commit-ID: ce31e66cbb9dd05685afb1236d1d71a513a96c91
Gitweb: https://git.kernel.org/tip/ce31e66cbb9dd05685afb1236d1d71a513a96c91
Author: Puranjay Mohan <puranjay@xxxxxxxxxx>
AuthorDate: Wed, 16 Sep 2026 11:43:19 -07:00
Committer: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
CommitterDate: Wed, 16 Sep 2026 17:13:28 -07:00
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@xxxxxxxxxx>
Assisted-by: Claude:claude-opus-5
Signed-off-by: Song Liu <song@xxxxxxxxxx>
Link: https://patch.msgid.link/20260916184351.2720310-27-song@xxxxxxxxxx
Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
---
tools/objtool/tests/generic/test-missing-checksum.sh | 18 +++++++++++-
1 file changed, 18 insertions(+)
create mode 100755 tools/objtool/tests/generic/test-missing-checksum.sh
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 0000000..89a05b1
--- /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"