Thread (88 messages) 88 messages, 2 authors, 11d ago

Re: [PATCH v2 32/58] objtool/klp: Add test for EXPORT_SYMBOL_FOR_MODULES references

From: Song Liu <song@kernel.org>
Date: 2026-09-14 21:04:55
Also in: sashiko-reviews

On Sun, Sep 13, 2026 at 11:45 PM [off-list ref] wrote:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The test script claims to cover commit d8a2860b4a36 but fails to exercise its logic because it patches vmlinux instead of a module.
--

commit 0018f6f310cd6d22138d9d2b74d24fb1f9be4ab3
Author: Song Liu [off-list ref]

objtool/klp: Add test for EXPORT_SYMBOL_FOR_MODULES references

This commit adds a test script to verify klp relocations for symbols
exported with EXPORT_SYMBOL_FOR_MODULES(). The test aims to cover the
behavior of previous fixes related to klp relocation section naming.
quoted
diff --git a/tools/objtool/tests/generic/test-export-symbol-for-modules.sh b/tools/objtool/tests/generic/test-export-symbol-for-modules.sh
new file mode 100755
index 0000000000000..7e7bdde6a7aca
--- /dev/null
+++ b/tools/objtool/tests/generic/test-export-symbol-for-modules.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
[ ... ]
quoted
+. "$(dirname "$0")/../lib.sh"
+
+setup
+build_pair cross_module.c
[Severity: Medium]
Does this test actually exercise the module-patching case fixed in
d8a2860b4a36?

By calling build_pair without a -DMODNAME flag, the test fixture defaults to
patching vmlinux. Because the patched object is vmlinux, the
__klp_relocs.vmlinux section is generated regardless of the logic introduced
in d8a2860b4a36.

That commit forces the section to vmlinux when the target is a vmlinux
symbol, overriding the patched module's name. As a result of patching
vmlinux directly here, the test appears to pass even without the fix it
claims to cover.

Should this test pass a module name to build_pair to properly test the module
relocation behavior?
Good catch! Fixed in v3.

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