Live Patching
 help / color / mirror / Atom feed
* [RFC PATCH v2 0/7] klp-build: OOT module support
@ 2026-08-26 19:49 Joe Lawrence
  2026-08-26 19:49 ` [RFC PATCH v2 1/7] objtool/klp: simplify read_exports file handling Joe Lawrence
                   ` (6 more replies)
  0 siblings, 7 replies; 17+ messages in thread
From: Joe Lawrence @ 2026-08-26 19:49 UTC (permalink / raw)
  To: live-patching
  Cc: Josh Poimboeuf, Song Liu, Miroslav Benes, Petr Mladek,
	Yafang Shao

This is RFCv2 of out-of-tree (OOT) module support for klp-build,
expanding on the original 4-patch series.  VERY lightly tested and coded
and most likely dangerous.  I'm posting to get feedback on the approach.
Brace for impact, Sashiko.


Motivation
----------

The initial RFC was motivated by stable, repeatable testing of 'objtool
klp diff'.  Standard in-tree drivers undergo frequent refactoring and
API churn, making them unreliable for producing consistent binary
patterns.  Smaller, targeted OOT test modules provide a stable baseline
for faster iteration before committing to an in-tree test case.

Feedback on v1 highlighted several production use cases for OOT in
general:

- Yafang Shao noted a real-world attempt to livepatch an OOT Mellanox
  driver in production that failed due to complex build dependencies.

- Song Liu noted that livepatching OOT modules in production is also a
  real use case at Meta, and that making it easy would likely see
  regular use.

- Song also observed (offlist) that the livepatch replace-set series
  would benefit from OOT support: replace-sets allow vendor and customer
  livepatches to coexist, where vendors patch the core kernel/distro
  modules while customers patch third-party, OOT drivers.

This feedback drove the addition of the "advanced" --orig-dir /
--patched-dir workflow (patches 6-7) for OOT drivers whose build systems
cannot be driven easily via `make M=`.


Series overview
---------------

Patches 1-4 are objtool prerequisites:
1 - Simplify read_exports() error handling (addresses Sashiko review)
2 - Add --symvers option to klp diff for custom Module.symvers paths
3 - Allow special section entry size overrides (allows tests to use
    objtool for cross-target/config processing)
4 - Embed target architecture in usage string (helps tests verify
    cross-target objtool)

Patch 5 provides baseline OOT capability:
5 - Add --oot-dir for simple modules built via 'make M=...'

At this point (patches 1-5), in-tree test and repro modules would be
supported via simple OOT dir builds.

Patches 6-7 extend OOT support for complex, real-world drivers:
6 - Add --orig-dir/--patched-dir for user-supplied pre-built objects
7 - Validate user-supplied objects (compiler match, -ffunction-sections)

The advanced workflow (patches 6-7) delegates the build process entirely
to the user, requiring only that objects are compiled with
-ffunction-sections and -fdata-sections.  klp-build then performs binary
comparison, symbol extraction, and livepatch assembly as usual.

As noted in the commit messages, output correctness depends directly on
the consistency of the inputs.  This is a HUGE footgun-rich space, but
provides flexibility for non-standard vendor build systems.


Changes
-------

RFC -> RFCv2
- Added read_exports() cleanup patch [Sashiko]
- Added pre-built object support for advanced OOT workflows [Song, Yafang]

RFC: https://lore.kernel.org/live-patching/20260512221102.2720763-1-joe.lawrence@redhat.com/

Joe Lawrence (7):
  objtool/klp: simplify read_exports file handling
  objtool/klp: add --symvers option to klp diff
  objtool/klp: allow special section entry size overrides
  objtool: add target architecture to usage
  livepatch/klp-build: add basic out-of-tree module support
  livepatch/klp-build: add pre-built object support for advanced OOT
    workflows
  livepatch/klp-build: add validation for user-supplied OOT objects

 scripts/livepatch/klp-build   | 229 ++++++++++++++++++++++++++++++----
 tools/objtool/Makefile        |   3 +-
 tools/objtool/builtin-check.c |   3 +-
 tools/objtool/klp-diff.c      |  68 ++++++++--
 4 files changed, 263 insertions(+), 40 deletions(-)


base-commit: d8a2860b4a366bfa8acb3d64da2c546ea26d2091
-- 
2.55.0


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

end of thread, other threads:[~2026-08-27 21:45 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-26 19:49 [RFC PATCH v2 0/7] klp-build: OOT module support Joe Lawrence
2026-08-26 19:49 ` [RFC PATCH v2 1/7] objtool/klp: simplify read_exports file handling Joe Lawrence
2026-08-26 23:31   ` Song Liu
2026-08-26 19:49 ` [RFC PATCH v2 2/7] objtool/klp: add --symvers option to klp diff Joe Lawrence
2026-08-26 23:31   ` Song Liu
2026-08-26 19:49 ` [RFC PATCH v2 3/7] objtool/klp: allow special section entry size overrides Joe Lawrence
2026-08-27 19:17   ` Josh Poimboeuf
2026-08-26 19:49 ` [RFC PATCH v2 4/7] objtool: add target architecture to usage Joe Lawrence
2026-08-26 19:57   ` sashiko-bot
2026-08-27 19:23   ` Josh Poimboeuf
2026-08-26 19:49 ` [RFC PATCH v2 5/7] livepatch/klp-build: add basic out-of-tree module support Joe Lawrence
2026-08-26 20:00   ` sashiko-bot
2026-08-27 21:21   ` Josh Poimboeuf
2026-08-26 19:49 ` [RFC PATCH v2 6/7] livepatch/klp-build: add pre-built object support for advanced OOT workflows Joe Lawrence
2026-08-26 20:01   ` sashiko-bot
2026-08-27 21:45   ` Josh Poimboeuf
2026-08-26 19:50 ` [RFC PATCH v2 7/7] livepatch/klp-build: add validation for user-supplied OOT objects Joe Lawrence

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