Live Patching
 help / color / mirror / Atom feed
* [PATCH v2 0/3] objtool/klp: Reject changed functions without an ftrace call site
@ 2026-10-22 17:16 Puranjay Mohan
  2026-10-22 17:16 ` [PATCH v2 1/3] objtool/klp: Build test fixtures with ftrace Puranjay Mohan
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Puranjay Mohan @ 2026-10-22 17:16 UTC (permalink / raw)
  To: live-patching
  Cc: Puranjay Mohan, Josh Poimboeuf, Peter Zijlstra, Song Liu,
	Miroslav Benes, Joe Lawrence

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


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

end of thread, other threads:[~2026-10-23 17:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-22 17:16 [PATCH v2 0/3] objtool/klp: Reject changed functions without an ftrace call site Puranjay Mohan
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

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