[tip: objtool/core] objtool/klp: Add test for unchecksummed input

tip-bot2 for Puranjay Mohan posted 1 patch 3 days, 9 hours ago
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
[tip: objtool/core] objtool/klp: Add test for unchecksummed input
Posted by tip-bot2 for Puranjay Mohan 3 days, 9 hours ago
The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     1ecf11530c16252dca835c9bc9133f73f5225ee4
Gitweb:        https://git.kernel.org/tip/1ecf11530c16252dca835c9bc9133f73f5225ee4
Author:        Puranjay Mohan <puranjay@kernel.org>
AuthorDate:    Wed, 16 Sep 2026 11:43:19 -07:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Mon, 21 Sep 2026 11:05:41 +02: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@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
---
 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"