Thread (82 messages) 82 messages, 2 authors, 25d ago

Re: [PATCH v3 40/58] objtool/klp: Add test for __bug_table, __ex_table and __mcount_loc extraction

From: Song Liu <song@kernel.org>
Date: 2026-09-15 23:28:07
Also in: sashiko-reviews

On Mon, Sep 14, 2026 at 5:26 PM [off-list ref] wrote:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] objtool/klp: temp directory leak in test script loop
--

commit 9f7016f6d159ad52d6af43f36ec58a96806eaf3b
Author: Song Liu [off-list ref]

objtool/klp: Add test for __bug_table, __ex_table and __mcount_loc extraction

This commit adds a test to verify the extraction of __bug_table, __ex_table,
and __mcount_loc sections by klp diff. The test uses a hand-crafted special
sections fixture. The test script repeatedly uses setup and cleanup to run diff
checks for each section.
quoted
diff --git a/tools/objtool/tests/x86/test-special-sections.sh b/tools/objtool/tests/x86/test-special-sections.sh
new file mode 100755
index 0000000000000..8dfaa4fc9a360
--- /dev/null
+++ b/tools/objtool/tests/x86/test-special-sections.sh
@@ -0,0 +1,42 @@
[ ... ]
quoted
+# section, entry size, relocations per entry
+for spec in "__bug_table 12 1" "__ex_table 12 2" "__mcount_loc 8 1"; do
+     set -- $spec
+     sec=$1
+
+     # A fresh workdir per section: run_diff caches its checksums.
+     setup
[Severity: Medium]
Will calling setup() inside this loop overwrite the $workdir variable with a
new temporary directory without removing the old one?
quoted
+     build_pair special_sections.c \
+             -DSPECIAL_SEC="\"$1\"" -DSPECIAL_ENTSIZE="$2" -DSPECIAL_RELOCS="$3"
+
+     assert_input_section "$sec"
+     run_diff
[ ... ]
quoted
+     assert_not_patched other
+     assert_no_reloc_sym "$sec" other
+
+     cleanup
[Severity: Medium]
Does calling cleanup() here fail to remove the directory because it
intentionally skips deletion until pass() or fail() sets KLP_TEST_REPORTED?

This appears to leave temporary directories in /tmp/ during successful runs
and clutter stdout with spurious '# kept' messages.
Fold a fix into 10/58 in v4.

Thanks,
Song
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help