From: Puranjay Mohan <puranjay@kernel.org>
To: live-patching@vger.kernel.org
Cc: Puranjay Mohan <puranjay@kernel.org>,
Josh Poimboeuf <jpoimboe@kernel.org>,
Peter Zijlstra <peterz@infradead.org>, Song Liu <song@kernel.org>,
Miroslav Benes <mbenes@suse.cz>,
Joe Lawrence <joe.lawrence@redhat.com>
Subject: [PATCH v2 0/3] objtool/klp: Reject changed functions without an ftrace call site
Date: Thu, 22 Oct 2026 10:16:33 -0700 [thread overview]
Message-ID: <20261022171637.3298443-1-puranjay@kernel.org> (raw)
Changelog:
v1: https://lore.kernel.org/all/20261022122544.125305-1-puranjay@kernel.org/
Changes in v2:
- test-special-sections: check __mcount_loc in its own block instead of
inside the section loop (Joe)
- Collected Joe's Acked-by on patches 2 and 3
A changed function without an ftrace call site makes klp-build produce a
patch module which fails to load. The kernel's 'inline' implies notrace,
so this happens whenever the compiler emits an inline function out of
line. Patch 2 makes klp diff reject such functions, patch 3 tests it.
Patch 1 builds the test fixtures with ftrace, which patch 2 needs.
Tested on x86_64 with GCC 11 and Clang 22: the objtool klp tests, and
klp-build with a vng boot, where a patch module built without the check
fails to load with "failed to find location for function".
Note for the arm64 klp-build series: arm64 has no __mcount_loc, so on
top of that series this would reject every changed function. It needs
mark_traceable_functions() to also handle __patchable_function_entries,
using pfe_offset. I can send that on top of the arm64 series.
Puranjay Mohan (3):
objtool/klp: Build test fixtures with ftrace
objtool/klp: Reject changed functions without an ftrace call site
objtool/klp: Add test for changed functions without an ftrace call
site
.../objtool/Documentation/klp-write-tests.txt | 9 ++-
tools/objtool/include/objtool/elf.h | 1 +
tools/objtool/klp-diff.c | 47 ++++++++++++
.../tests/generic/test-thinlto-ambiguity.sh | 3 +-
.../tests/generic/test-thinlto-local.sh | 5 +-
tools/objtool/tests/lib.sh | 42 ++++++++++-
.../tests/x86/fixtures/notrace_target.c | 71 ++++++++++++++++++
tools/objtool/tests/x86/test-checksum-alt.sh | 4 -
.../objtool/tests/x86/test-notrace-target.sh | 74 +++++++++++++++++++
.../tests/x86/test-special-sections.sh | 12 ++-
10 files changed, 254 insertions(+), 14 deletions(-)
create mode 100644 tools/objtool/tests/x86/fixtures/notrace_target.c
create mode 100755 tools/objtool/tests/x86/test-notrace-target.sh
base-commit: 6ecc854643e6fd6a2d07bc8d83015c7c34a951eb
--
2.53.0-Meta
next reply other threads:[~2026-10-22 17:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-22 17:16 Puranjay Mohan [this message]
2026-10-22 17:16 ` [PATCH v2 1/3] objtool/klp: Build test fixtures with ftrace Puranjay Mohan
2026-10-22 17:16 ` [PATCH v2 2/3] objtool/klp: Reject changed functions without an ftrace call site Puranjay Mohan
2026-10-22 17:16 ` [PATCH v2 3/3] objtool/klp: Add test for " Puranjay Mohan
2026-10-23 15:19 ` [PATCH v2 0/3] objtool/klp: Reject " Joe Lawrence
2026-10-23 17:44 ` Song Liu
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=20261022171637.3298443-1-puranjay@kernel.org \
--to=puranjay@kernel.org \
--cc=joe.lawrence@redhat.com \
--cc=jpoimboe@kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=mbenes@suse.cz \
--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