Thread (69 messages) 69 messages, 2 authors, 5d ago

Re: [PATCH v4 39/58] objtool/klp: Add test for static locals which must not be correlated

From: Song Liu <song@kernel.org>
Date: 2026-09-16 17:51:44
Also in: sashiko-reviews

On Tue, Sep 15, 2026 at 4:51 PM [off-list ref] wrote:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] objtool: klp test regex fails on architectures with small data sections
--

commit 4400f73b697d110a1f506b61da1421c4d22b7608
Author: Song Liu [off-list ref]

objtool/klp: Add test for static locals which must not be correlated

This commit adds an objtool livepatch test to verify that certain static
local variables are properly uncorrelated in patched functions. It checks
that .data..once flags and per-instance variables use a fresh copy, while
ordinary static locals remain correlated.
quoted
diff --git a/tools/objtool/tests/generic/test-static-local-uncorrelated.sh b/tools/objtool/tests/generic/test-static-local-uncorrelated.sh
new file mode 100755
index 0000000000000..fa4ce88a79b1e
--- /dev/null
+++ b/tools/objtool/tests/generic/test-static-local-uncorrelated.sh
[ ... ]
quoted
+
+# Not correlated: no klp symbol, and a copy cloned into the patch instead.
+out_symbols | grep -q '\.klp\.sym\..*__key' &&
+     fail "__key was correlated; it must use a fresh copy"
+out_sections | grep -qE '\.(bss|data)[^ ]*__key' ||
+     fail "__key was neither correlated nor cloned"
[Severity: Medium]
Will this grep pattern cause spurious test failures on architectures that use
small data sections?

When compiling for architectures like PowerPC or LoongArch, the compiler might
place small variables like __key into .sbss or .sdata rather than .bss or
.data. Since the regex strictly expects .bss or .data, it appears it will fail
when small data sections are used.
I don't have PowerPC or LoongArch to test. Claude proposed something
like:

   out_sections | grep -qE '\.s?(bss|data)[^ ]*__key'

which allows .sbss and .sdata in addition to .bss and .data.

I will use this version in v5.

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