Lines Matching +full:pre +full:- +full:its
2 # SPDX-License-Identifier: GPL-2.0
19 # - On livepatch enable, before the livepatch transition starts,
20 # pre-patch callbacks are executed for vmlinux and $MOD_TARGET (those
22 # according to the klp_patch, their post-patch callbacks run and the
25 # - Similarly, on livepatch disable, pre-patch callbacks run before the
26 # unpatching transition starts. klp_objects are reverted, post-patch
43 $MOD_LIVEPATCH: pre_patch_callback: $MOD_TARGET -> [MODULE_STATE_LIVE] Normal state
47 $MOD_LIVEPATCH: post_patch_callback: $MOD_TARGET -> [MODULE_STATE_LIVE] Normal state
52 $MOD_LIVEPATCH: pre_unpatch_callback: $MOD_TARGET -> [MODULE_STATE_LIVE] Normal state
56 $MOD_LIVEPATCH: post_unpatch_callback: $MOD_TARGET -> [MODULE_STATE_LIVE] Normal state
67 # - On livepatch enable, only pre/post-patch callbacks are executed for
70 # - When a targeted module is subsequently loaded, only its
71 # pre/post-patch callbacks are executed.
73 # - On livepatch disable, all currently loaded klp_objects' (vmlinux and
74 # $MOD_TARGET) pre/post-unpatch callbacks are executed.
94 $MOD_LIVEPATCH: pre_patch_callback: $MOD_TARGET -> [MODULE_STATE_COMING] Full formed, running modul…
95 $MOD_LIVEPATCH: post_patch_callback: $MOD_TARGET -> [MODULE_STATE_COMING] Full formed, running modu…
100 $MOD_LIVEPATCH: pre_unpatch_callback: $MOD_TARGET -> [MODULE_STATE_LIVE] Normal state
104 $MOD_LIVEPATCH: post_unpatch_callback: $MOD_TARGET -> [MODULE_STATE_LIVE] Normal state
115 # - First load a target module, then the livepatch.
117 # - When a target module is unloaded, the livepatch is only reverted
118 # from that klp_object ($MOD_TARGET). As such, only its pre and
119 # post-unpatch callbacks are executed when this occurs.
121 # - When the livepatch is disabled, pre and post-unpatch callbacks are
138 $MOD_LIVEPATCH: pre_patch_callback: $MOD_TARGET -> [MODULE_STATE_LIVE] Normal state
142 $MOD_LIVEPATCH: post_patch_callback: $MOD_TARGET -> [MODULE_STATE_LIVE] Normal state
146 $MOD_LIVEPATCH: pre_unpatch_callback: $MOD_TARGET -> [MODULE_STATE_GOING] Going away
148 $MOD_LIVEPATCH: post_unpatch_callback: $MOD_TARGET -> [MODULE_STATE_GOING] Going away
163 # - First load the livepatch.
165 # - When a targeted kernel module is subsequently loaded, only its
166 # pre/post-patch callbacks are executed.
168 # - When the target module is unloaded, the livepatch is only reverted
169 # from the $MOD_TARGET klp_object. As such, only pre and
170 # post-unpatch callbacks are executed when this occurs.
190 $MOD_LIVEPATCH: pre_patch_callback: $MOD_TARGET -> [MODULE_STATE_COMING] Full formed, running modul…
191 $MOD_LIVEPATCH: post_patch_callback: $MOD_TARGET -> [MODULE_STATE_COMING] Full formed, running modu…
195 $MOD_LIVEPATCH: pre_unpatch_callback: $MOD_TARGET -> [MODULE_STATE_GOING] Going away
197 $MOD_LIVEPATCH: post_unpatch_callback: $MOD_TARGET -> [MODULE_STATE_GOING] Going away
208 # A simple test of loading a livepatch without one of its patch target
211 # - Load the livepatch.
213 # - As expected, only pre/post-(un)patch handlers are executed for
240 # Test a scenario where a vmlinux pre-patch callback returns a non-zero
243 # - First load a target module.
245 # - Load the livepatch module, setting its 'pre_patch_ret' value to -19
246 # (-ENODEV). When its vmlinux pre-patch callback executes, this
247 # status code will propagate back to the module-loading subsystem.
251 start_test "pre-patch callback -ENODEV"
254 load_failing_mod $MOD_LIVEPATCH pre_patch_ret=-19
259 % modprobe $MOD_LIVEPATCH pre_patch_ret=-19
263 livepatch: pre-patch callback failed for object 'vmlinux'
273 # Similar to the previous test, setup a livepatch such that its vmlinux
274 # pre-patch callback returns success. However, when a targeted kernel
278 # - Load the livepatch, vmlinux pre-patch callback succeeds.
280 # - Set a trap so subsequent pre-patch callbacks to this livepatch will
281 # return -ENODEV.
283 # - The livepatch pre-patch callback for subsequently loaded target
285 # the kernel module. No post-patch or pre/post-unpatch callbacks are
288 # - Pre/post-unpatch callbacks are run for the vmlinux klp_object.
290 start_test "module_coming + pre-patch callback -ENODEV"
293 set_pre_patch_ret $MOD_LIVEPATCH -19
306 % echo -19 > /sys/module/$MOD_LIVEPATCH/parameters/pre_patch_ret
309 $MOD_LIVEPATCH: pre_patch_callback: $MOD_TARGET -> [MODULE_STATE_COMING] Full formed, running modul…
310 livepatch: pre-patch callback failed for object '$MOD_TARGET'
323 # Test loading multiple targeted kernel modules. This test-case is
324 # mainly for comparing with the next test-case.
326 # - Load a target "busy" kernel module which kicks off a worker function
329 # - Proceed with loading the livepatch and another ordinary target
330 # module. Post-patch callbacks are executed and the transition
351 $MOD_LIVEPATCH: pre_patch_callback: $MOD_TARGET_BUSY -> [MODULE_STATE_LIVE] Normal state
355 $MOD_LIVEPATCH: post_patch_callback: $MOD_TARGET_BUSY -> [MODULE_STATE_LIVE] Normal state
359 $MOD_LIVEPATCH: pre_patch_callback: $MOD_TARGET -> [MODULE_STATE_COMING] Full formed, running modul…
360 $MOD_LIVEPATCH: post_patch_callback: $MOD_TARGET -> [MODULE_STATE_COMING] Full formed, running modu…
364 $MOD_LIVEPATCH: pre_unpatch_callback: $MOD_TARGET -> [MODULE_STATE_GOING] Going away
366 $MOD_LIVEPATCH: post_unpatch_callback: $MOD_TARGET -> [MODULE_STATE_GOING] Going away
370 $MOD_LIVEPATCH: pre_unpatch_callback: $MOD_TARGET_BUSY -> [MODULE_STATE_LIVE] Normal state
374 $MOD_LIVEPATCH: post_unpatch_callback: $MOD_TARGET_BUSY -> [MODULE_STATE_LIVE] Normal state
385 # executing a to-be-patched function -- the consistency model stalls the
386 # current patch transition until this safety-check is met. Test a
391 # - Load the "busy" kernel module, this time make its work function loop
393 # - Meanwhile, the livepatch is loaded. Notice that the patch
395 # sitting on a to-be-patched function.
397 # - Load a second target module (this one is an ordinary idle kernel
398 # module). Note that *no* post-patch callbacks will be executed while
401 # - Request an unload of the simple kernel module. The patch is still
402 # transitioning, so its pre-unpatch callbacks are skipped.
404 # - Finally the livepatch is disabled. Since none of the patch's
405 # klp_object's post-patch callbacks executed, the remaining
406 # klp_object's pre-unpatch callbacks are skipped.
413 # Wait until the livepatch reports in-transition state, i.e. that it's
415 loop_until 'grep -q '^1$' /sys/kernel/livepatch/$MOD_LIVEPATCH/transition' ||
431 $MOD_LIVEPATCH: pre_patch_callback: $MOD_TARGET_BUSY -> [MODULE_STATE_LIVE] Normal state
435 $MOD_LIVEPATCH: pre_patch_callback: $MOD_TARGET -> [MODULE_STATE_COMING] Full formed, running modul…
440 $MOD_LIVEPATCH: post_unpatch_callback: $MOD_TARGET -> [MODULE_STATE_GOING] Going away
446 $MOD_LIVEPATCH: post_unpatch_callback: $MOD_TARGET_BUSY -> [MODULE_STATE_LIVE] Normal state
454 # Test loading multiple livepatches. This test-case is mainly for comparing
455 # with the next test-case.
457 # - Load and unload two livepatches, pre and post (un)patch callbacks
458 # execute as each patch progresses through its (un)patching
504 # Load multiple livepatches, but the second as an 'atomic-replace'
506 # disabled and *none* of its pre/post-unpatch callbacks executed. On
507 # the other hand, when the atomic-replace livepatch is disabled, its
508 # pre/post-unpatch callbacks *should* be executed.
510 # - Load and unload two livepatches, the second of which has its
513 # - Pre and post patch callbacks are executed for both livepatches.
515 # - Once the atomic replace module is loaded, only its pre and post