# Re: \[RFC PATCH v2 11/11\] objtool/klp: Test symbol identity and state preservation

- From: sashiko-bot@kernel.org
- Date: 2026-11-04 13:50:11 
- List: live-patching
- Page: https://ratatoskr.run/live-patching/2026/11/17860922
- Thread: https://ratatoskr.run/live-patching/2026/11/17860792/t.md

```text
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] objtool/klp: test suite left failing and sympos coverage lost
--

commit 81f49775a536febbdc9ffe953af763d00e57323f
Author: Longjun Luo [ref]

objtool/klp: Test symbol identity and state preservation

This commit adds tests and fixtures to exercise symbol identity and local
state preservation across source changes, inlining, compiler renaming, and
LTO in objtool klp.

>     objtool/klp: Test symbol identity and state preservation
>     
>     Exercise local state across source changes, inlining, compiler renaming
>     and LTO. Check that patches reference the original objects and allocate
>     only new state. Cover aliases, assembly, metadata, ICF, DWARF pieces,
>     shrunk storage, reduced information and saved DWP files. Cover separate
>     cold-fragment identities left by weak overrides.
>     
>     Check rejection of ambiguous repeated statics, conflicting references
>     and changed data. Complete compound-reference tests and add same-named
>     target switches for the identity-based reference checksum.
>     
>     Skip the saved-DWP test when the linked libdw lacks DWP support.
>     
>     The full suite has 68 passes with GCC 16.2.1 and 75 with Clang
>     22.1.8. Only local-to-global-flip, sympos and sympos-vmlinux fail,
>     reflecting the linkage and duplicate-identity policies.
>     
>     Assisted-by: LLM
>     Signed-off-by: Longjun Luo [ref]

[Severity: Medium]
Does leaving test-local-to-global-flip.sh, test-sympos.sh, and
test-sympos-vmlinux.sh failing cause the test suite runner in
tools/objtool/tests/run-tests.sh to always exit non-zero, while also losing
all test coverage for sympos calculation?

In tools/objtool/tests/run-tests.sh, the runner exits non-zero whenever any
test fails without xfail:

    [ "$fail" = 0 ] && [ "$xpass" = 0 ]

In tools/objtool/tests/generic/test-sympos.sh and
tools/objtool/tests/generic/test-sympos-vmlinux.sh, the scripts compile a
single source file twice to produce two translation units with a same-named
static variable (dup_counter):

tools/objtool/tests/generic/test-sympos.sh:
	build_one sympos_dup.c "a$p.o" -DFUNC_NAME=use_a $p
	# shellcheck disable=SC2086
	build_one sympos_dup.c "b$p.o" -DFUNC_NAME=use_b -DNO_MODINFO $p

tools/objtool/tests/generic/test-sympos-vmlinux.sh:
build_one sympos_vmlinux.c orig_a.o    -DFUNC_NAME=use_a -DVARSEC='".data.zzz"'
build_one sympos_vmlinux.c patched_a.o -DFUNC_NAME=use_a -DVARSEC='".data.zzz"' -DPATCHED
build_one sympos_vmlinux.c b.o         -DFUNC_NAME=use_b -DVARSEC='".data.aaa"' -DNO_MODINFO

Because both objects are compiled from the exact same source file path,
they share an identical DWARF CU path, causing validate_dwarf_identity() in
tools/objtool/klp-identity.c to abort during klp checksum with a duplicate
symbol identity error before klp diff ever runs. As a result,
klp_find_sympos() and .klp.symid vmlinux address-order resolution are never
reached or tested.

Similarly, in tools/objtool/tests/generic/test-local-to-global-flip.sh:

    run_diff

    assert_diff_log 'changed function: caller'

the test still expects klp diff to succeed and correlate symbols across
linkage changes, whereas check_linkage_changes() in tools/objtool/klp-diff.c
now rejects linkage flips with exit status 255.

Should test-sympos.sh and test-sympos-vmlinux.sh compile separate source
files so their DWARF CU paths are distinct and sympos resolution is still
exercised, and should test-local-to-global-flip.sh be updated to assert the
linkage rejection so the test suite passes cleanly?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261104133158.3187525-1-luolongjuna@gmail.com?part=11
```
