From: Binoy Ravindran via B4 Relay <devnull+binoy.vt.edu@kernel.org>
To: Josh Poimboeuf <jpoimboe@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Song Liu <song@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Bill Wendling <morbo@google.com>,
Justin Stitt <justinstitt@google.com>
Cc: Joe Lawrence <joe.lawrence@redhat.com>,
linux-kernel@vger.kernel.org, llvm@lists.linux.dev,
Binoy Ravindran <binoy@vt.edu>
Subject: [PATCH v2 0/2] objtool/klp: Copy constant pool entries for local labels
Date: Mon, 30 Nov 2026 18:50:36 -0500 [thread overview]
Message-ID: <20261130-objtool-klp-cst-v2-0-2718c17fca37@vt.edu> (raw)
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>
next reply other threads:[~2026-11-30 23:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 23:50 Binoy Ravindran via B4 Relay [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261130-objtool-klp-cst-v2-0-2718c17fca37@vt.edu \
--to=devnull+binoy.vt.edu@kernel.org \
--cc=binoy@vt.edu \
--cc=joe.lawrence@redhat.com \
--cc=jpoimboe@kernel.org \
--cc=justinstitt@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=peterz@infradead.org \
--cc=song@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®