[PATCH v2 0/2] objtool/klp: Copy constant pool entries for local labels
From: Binoy Ravindran via B4 Relay
Date: Mon Nov 30 2026 - 18:50:57 EST
A small problem in __clone_symbol(): a .LC label in a .rodata.cst*
pool has no size, so its constant is never copied into the livepatch
module, and the patched function reads whatever bytes follow. Patch 1
fixes it. Details and the three affected modules are in that patch.
Patch 2 adds a test to tools/objtool/tests, as Joe suggested. With
patch 1's change to klp-diff.c reverted it fails, and with the change
in place it passes, under gcc 12.2.0 and clang 14.0.6. The whole suite
passes under both compilers.
One thing I noticed while running the suite: with a gcc built with
--enable-default-pie, as Debian's is, -mnop-mcount is rejected,
preflight falls back to objtool's mcount, and every gcc test that
needs an ftrace call site fails with "no ftrace call site, can't
patch". CC="gcc -fno-PIE -fcf-protection=none" avoids it. The kernel
always builds with -fno-PIE, so FIXTURE_CFLAGS might want it as well.
I can send a patch for that if it is useful.
---
Changes in v2:
- Add a test for the fix (Joe).
- Add Joe's Acked-by to patch 1.
- Link to v1: https://patch.msgid.link/20261127-objtool-klp-cst-v1-1-dc19b08c8676@xxxxxx
---
Binoy Ravindran (2):
objtool/klp: Copy constant pool entries for local labels
objtool/klp: Add test for constant pool labels
tools/objtool/klp-diff.c | 15 +++-
.../objtool/tests/generic/fixtures/constant_pool.c | 31 ++++++++
tools/objtool/tests/generic/test-constant-pool.sh | 91 ++++++++++++++++++++++
3 files changed, 135 insertions(+), 2 deletions(-)
---
base-commit: b99a5337da3c847db216476d645b69acd714c3ba
change-id: 20261127-objtool-klp-cst-53a24047f0e9
Best regards,
--
Binoy Ravindran <binoy@xxxxxx>