livepatch: add (un)patch callbacks
authorJoe Lawrence <joe.lawrence@redhat.com>
Fri, 13 Oct 2017 19:08:41 +0000 (15:08 -0400)
committerJiri Kosina <jkosina@suse.cz>
Thu, 19 Oct 2017 08:08:56 +0000 (10:08 +0200)
commit93862e385ded7c60351e09fcd2a541d273650905
tree22dc512303e988d00e327fa05c884e542fb5af55
parent19205da6a0da701787d42ad754edd1ffb514c956
livepatch: add (un)patch callbacks

Provide livepatch modules a klp_object (un)patching notification
mechanism.  Pre and post-(un)patch callbacks allow livepatch modules to
setup or synchronize changes that would be difficult to support in only
patched-or-unpatched code contexts.

Callbacks can be registered for target module or vmlinux klp_objects,
but each implementation is klp_object specific.

  - Pre-(un)patch callbacks run before any (un)patching transition
    starts.

  - Post-(un)patch callbacks run once an object has been (un)patched and
    the klp_patch fully transitioned to its target state.

Example use cases include modification of global data and registration
of newly available services/handlers.

See Documentation/livepatch/callbacks.txt for details and
samples/livepatch/ for examples.

Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Acked-by: Miroslav Benes <mbenes@suse.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Documentation/livepatch/callbacks.txt [new file with mode: 0644]
include/linux/livepatch.h
kernel/livepatch/core.c
kernel/livepatch/core.h
kernel/livepatch/patch.c
kernel/livepatch/transition.c
samples/livepatch/Makefile
samples/livepatch/livepatch-callbacks-busymod.c [new file with mode: 0644]
samples/livepatch/livepatch-callbacks-demo.c [new file with mode: 0644]
samples/livepatch/livepatch-callbacks-mod.c [new file with mode: 0644]