mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] objtool/klp: Copy constant pool entries for local labels
@ 2026-11-30 23:50 Binoy Ravindran via B4 Relay
  2026-11-30 23:50 ` [PATCH v2 1/2] " Binoy Ravindran via B4 Relay
  2026-11-30 23:50 ` [PATCH v2 2/2] objtool/klp: Add test for constant pool labels Binoy Ravindran via B4 Relay
  0 siblings, 2 replies; 3+ messages in thread
From: Binoy Ravindran via B4 Relay @ 2026-11-30 23:50 UTC (permalink / raw)
  To: Josh Poimboeuf, Peter Zijlstra, Song Liu, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt
  Cc: Joe Lawrence, linux-kernel, llvm, Binoy Ravindran

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@vt.edu

---
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@vt.edu>



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-30 23:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-30 23:50 [PATCH v2 0/2] objtool/klp: Copy constant pool entries for local labels Binoy Ravindran via B4 Relay
2026-11-30 23:50 ` [PATCH v2 1/2] " Binoy Ravindran via B4 Relay
2026-11-30 23:50 ` [PATCH v2 2/2] objtool/klp: Add test for constant pool labels Binoy Ravindran via B4 Relay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®