Lines Matching refs:patch
5 Livepatch (un)patch-callbacks provide a mechanism for livepatch modules
16 In most cases, (un)patch callbacks will need to be used in conjunction
23 patch.
33 * Pre-patch - before a klp_object is patched
35 * Post-patch - after a klp_object has been patched and is active
39 active), used to clean up post-patch callback
44 used to cleanup pre-patch callback resources
48 symmetry: pre-patch callbacks have a post-unpatch counterpart and
49 post-patch callbacks have a pre-unpatch counterpart. An unpatch
50 callback will only be executed if its corresponding patch callback was
51 executed. Typical use cases pair a patch handler that acquires and
57 when a livepatch is enabled/disabled. For patch target kernel modules,
62 The pre-patch callback, if specified, is expected to return a status
65 safe and to stop the current patching request. (When no pre-patch
67 pre-patch callback returns failure, the kernel's module loader will:
77 No post-patch, pre-unpatch, or post-unpatch callbacks will be executed
78 for a given klp_object if the object failed to patch, due to a failed
81 If a patch transition is reversed, no pre-unpatch handlers will be run
83 will only occur if their corresponding post-patch callback executed).
85 If the object did successfully patch, but the patch transition never
86 started for some reason (e.g., if another object failed to patch),
96 A pre-patch callback can be useful to update a global variable. For
102 patch the data *after* patching is complete with a post-patch callback,
111 may be possible to implement similar updates via pre/post-patch
116 pre/post-patch callback could iterate over all such devices, making a
125 pre/post-(un)patch combination, but a selection that demonstrates a few
149 On livepatch enable, before the livepatch transition starts, pre-patch
152 to the klp_patch, their post-patch callbacks run and the transition
156 [ 36.503719] livepatch: enabling patch 'livepatch_callbacks_demo'
166 Similarly, on livepatch disable, pre-patch callbacks run before the
167 unpatching transition starts. klp_objects are reverted, post-patch
199 On livepatch enable, only pre/post-patch callbacks are executed for
203 [ 44.553328] livepatch: enabling patch 'livepatch_callbacks_demo'
211 When a targeted module is subsequently loaded, only its pre/post-patch
215 …[ 46.560845] livepatch: applying patch 'livepatch_callbacks_demo' to loading module 'livepatch_c…
257 [ 56.613919] livepatch: enabling patch 'livepatch_callbacks_demo'
274 …[ 58.624658] livepatch: reverting patch 'livepatch_callbacks_demo' on unloading module 'livepatc…
307 [ 64.661552] livepatch: enabling patch 'livepatch_callbacks_demo'
316 pre/post-patch callbacks are executed:
319 …[ 66.669196] livepatch: applying patch 'livepatch_callbacks_demo' to loading module 'livepatch_c…
331 …[ 68.681452] livepatch: reverting patch 'livepatch_callbacks_demo' on unloading module 'livepatc…
348 A simple test of loading a livepatch without one of its patch target
358 [ 74.711081] livepatch: enabling patch 'livepatch_callbacks_demo'
366 As expected, only pre/post-(un)patch handlers are executed for vmlinux:
382 Test a scenario where a vmlinux pre-patch callback returns a non-zero
395 (-ENODEV). When its vmlinux pre-patch callback executed, this status
400 [ 82.747326] livepatch: enabling patch 'livepatch_callbacks_demo'
403 [ 82.748237] livepatch: pre-patch callback failed for object 'vmlinux'
404 [ 82.748637] livepatch: failed to enable patch 'livepatch_callbacks_demo'
418 pre-patch callback returns success. However, when a targeted kernel
427 Load the livepatch, notice vmlinux pre-patch callback succeeds:
430 [ 86.787845] livepatch: enabling patch 'livepatch_callbacks_demo'
438 Set a trap so subsequent pre-patch callbacks to this livepatch will
443 The livepatch pre-patch callback for subsequently loaded target modules
445 module. Notice that no post-patch or pre/post-unpatch callbacks are
449 …[ 90.796976] livepatch: applying patch 'livepatch_callbacks_demo' to loading module 'livepatch_c…
451 [ 90.798900] livepatch: pre-patch callback failed for object 'livepatch_callbacks_mod'
452 …[ 90.799652] livepatch: patch 'livepatch_callbacks_demo' failed for module 'livepatch_callbacks_…
492 notice that the post-patch callbacks are executed and the transition
496 [ 98.917892] livepatch: enabling patch 'livepatch_callbacks_demo'
507 …[ 100.930955] livepatch: applying patch 'livepatch_callbacks_demo' to loading module 'livepatch_c…
515 …[ 102.944585] livepatch: reverting patch 'livepatch_callbacks_demo' on unloading module 'livepatc…
539 The livepatching core will refuse to patch a task that is currently
541 current patch transition until this safety-check is met. Test a
562 Meanwhile, the livepatch is loaded. Notice that the patch transition
567 [ 113.000309] livepatch: enabling patch 'livepatch_callbacks_demo'
574 module). Note that *no* post-patch callbacks will be executed while the
578 …[ 115.012740] livepatch: applying patch 'livepatch_callbacks_demo' to loading module 'livepatch_c…
582 Request an unload of the simple kernel module. The patch is still
587 …[ 117.023376] livepatch: reverting patch 'livepatch_callbacks_demo' on unloading module 'livepatc…
590 Finally the livepatch is disabled. Since none of the patch's
591 klp_object's post-patch callbacks executed, the remaining klp_object's