[PATCH] livepatch hooks, revisted
From: Joe Lawrence
Date: Wed Jul 12 2017 - 10:11:56 EST
Hi all,
This patch revists the effort that Chris Argus made last year to port
kpatch-style "load hooks" to livepatch:
https://lkml.org/lkml/2016/8/26/434
Since that discussion, the consistency model has been merged.
This patch locates the hooks in a slightly different place, providing
callbacks to a livepatch module whenever a klp_object is being patched
or unpatched.
A pointer to the current klp_object undergoing (un)patching is also
passed to the hook callback -- with that in hand, the hook
implementation can make decisions based on the current module state
(live, coming, going).
A new Documentation/ file is provided as well as a contrived sample
module and livepatch demo to demonstrate the callbacks. The example is
about as simple as possible, but could be further embellished to
resemble a real-world livepatch fix if desired.
Thanks,
Joe Lawrence (1):
livepatch: add (un)patch hooks
Documentation/livepatch/hooks.txt | 98 +++++++++++++++++++++++++
include/linux/livepatch.h | 32 ++++++++
kernel/livepatch/core.c | 5 --
kernel/livepatch/patch.c | 35 +++++++++
samples/livepatch/Makefile | 2 +
samples/livepatch/livepatch-hooks-demo.c | 122 +++++++++++++++++++++++++++++++
samples/livepatch/livepatch-hooks-mod.c | 38 ++++++++++
7 files changed, 327 insertions(+), 5 deletions(-)
create mode 100644 Documentation/livepatch/hooks.txt
create mode 100644 samples/livepatch/livepatch-hooks-demo.c
create mode 100644 samples/livepatch/livepatch-hooks-mod.c
--
1.8.3.1