@@ -12,8 +12,6 @@ MOD_TARGET_BUSY=test_klp_callbacks_busy
12
12
setup_config
13
13
14
14
15
- # TEST: target module before livepatch
16
- #
17
15
# Test a combination of loading a kernel module and a livepatch that
18
16
# patches a function in the first module. Load the target module
19
17
# before the livepatch module. Unload them in the same order.
@@ -28,8 +26,7 @@ setup_config
28
26
# unpatching transition starts. klp_objects are reverted, post-patch
29
27
# callbacks execute and the transition completes.
30
28
31
- echo -n " TEST: target module before livepatch ... "
32
- dmesg -C
29
+ start_test " target module before livepatch"
33
30
34
31
load_mod $MOD_TARGET
35
32
load_lp $MOD_LIVEPATCH
@@ -63,8 +60,6 @@ livepatch: '$MOD_LIVEPATCH': unpatching complete
63
60
$MOD_TARGET : ${MOD_TARGET} _exit"
64
61
65
62
66
- # TEST: module_coming notifier
67
- #
68
63
# This test is similar to the previous test, but (un)load the livepatch
69
64
# module before the target kernel module. This tests the livepatch
70
65
# core's module_coming handler.
@@ -78,8 +73,7 @@ $MOD_TARGET: ${MOD_TARGET}_exit"
78
73
# - On livepatch disable, all currently loaded klp_objects' (vmlinux and
79
74
# $MOD_TARGET) pre/post-unpatch callbacks are executed.
80
75
81
- echo -n " TEST: module_coming notifier ... "
82
- dmesg -C
76
+ start_test " module_coming notifier"
83
77
84
78
load_lp $MOD_LIVEPATCH
85
79
load_mod $MOD_TARGET
@@ -114,8 +108,6 @@ livepatch: '$MOD_LIVEPATCH': unpatching complete
114
108
$MOD_TARGET : ${MOD_TARGET} _exit"
115
109
116
110
117
- # TEST: module_going notifier
118
- #
119
111
# Test loading the livepatch after a targeted kernel module, then unload
120
112
# the kernel module before disabling the livepatch. This tests the
121
113
# livepatch core's module_going handler.
@@ -129,8 +121,7 @@ $MOD_TARGET: ${MOD_TARGET}_exit"
129
121
# - When the livepatch is disabled, pre and post-unpatch callbacks are
130
122
# run for the remaining klp_object, vmlinux.
131
123
132
- echo -n " TEST: module_going notifier ... "
133
- dmesg -C
124
+ start_test " module_going notifier"
134
125
135
126
load_mod $MOD_TARGET
136
127
load_lp $MOD_LIVEPATCH
@@ -165,8 +156,6 @@ livepatch: '$MOD_LIVEPATCH': unpatching complete
165
156
% rmmod $MOD_LIVEPATCH "
166
157
167
158
168
- # TEST: module_coming and module_going notifiers
169
- #
170
159
# This test is similar to the previous test, however the livepatch is
171
160
# loaded first. This tests the livepatch core's module_coming and
172
161
# module_going handlers.
@@ -180,8 +169,7 @@ livepatch: '$MOD_LIVEPATCH': unpatching complete
180
169
# from the $MOD_TARGET klp_object. As such, only pre and
181
170
# post-unpatch callbacks are executed when this occurs.
182
171
183
- echo -n " TEST: module_coming and module_going notifiers ... "
184
- dmesg -C
172
+ start_test " module_coming and module_going notifiers"
185
173
186
174
load_lp $MOD_LIVEPATCH
187
175
load_mod $MOD_TARGET
@@ -217,8 +205,6 @@ livepatch: '$MOD_LIVEPATCH': unpatching complete
217
205
% rmmod $MOD_LIVEPATCH "
218
206
219
207
220
- # TEST: target module not present
221
- #
222
208
# A simple test of loading a livepatch without one of its patch target
223
209
# klp_objects ever loaded ($MOD_TARGET).
224
210
#
@@ -227,8 +213,7 @@ livepatch: '$MOD_LIVEPATCH': unpatching complete
227
213
# - As expected, only pre/post-(un)patch handlers are executed for
228
214
# vmlinux.
229
215
230
- echo -n " TEST: target module not present ... "
231
- dmesg -C
216
+ start_test " target module not present"
232
217
233
218
load_lp $MOD_LIVEPATCH
234
219
disable_lp $MOD_LIVEPATCH
@@ -252,8 +237,6 @@ livepatch: '$MOD_LIVEPATCH': unpatching complete
252
237
% rmmod $MOD_LIVEPATCH "
253
238
254
239
255
- # TEST: pre-patch callback -ENODEV
256
- #
257
240
# Test a scenario where a vmlinux pre-patch callback returns a non-zero
258
241
# status (ie, failure).
259
242
#
@@ -265,8 +248,7 @@ livepatch: '$MOD_LIVEPATCH': unpatching complete
265
248
# The result is that the insmod command refuses to load the livepatch
266
249
# module.
267
250
268
- echo -n " TEST: pre-patch callback -ENODEV ... "
269
- dmesg -C
251
+ start_test " pre-patch callback -ENODEV"
270
252
271
253
load_mod $MOD_TARGET
272
254
load_failing_mod $MOD_LIVEPATCH pre_patch_ret=-19
@@ -288,8 +270,6 @@ modprobe: ERROR: could not insert '$MOD_LIVEPATCH': No such device
288
270
$MOD_TARGET : ${MOD_TARGET} _exit"
289
271
290
272
291
- # TEST: module_coming + pre-patch callback -ENODEV
292
- #
293
273
# Similar to the previous test, setup a livepatch such that its vmlinux
294
274
# pre-patch callback returns success. However, when a targeted kernel
295
275
# module is later loaded, have the livepatch return a failing status
@@ -307,8 +287,7 @@ $MOD_TARGET: ${MOD_TARGET}_exit"
307
287
#
308
288
# - Pre/post-unpatch callbacks are run for the vmlinux klp_object.
309
289
310
- echo -n " TEST: module_coming + pre-patch callback -ENODEV ... "
311
- dmesg -C
290
+ start_test " module_coming + pre-patch callback -ENODEV"
312
291
313
292
load_lp $MOD_LIVEPATCH
314
293
set_pre_patch_ret $MOD_LIVEPATCH -19
@@ -341,8 +320,6 @@ livepatch: '$MOD_LIVEPATCH': unpatching complete
341
320
% rmmod $MOD_LIVEPATCH "
342
321
343
322
344
- # TEST: multiple target modules
345
- #
346
323
# Test loading multiple targeted kernel modules. This test-case is
347
324
# mainly for comparing with the next test-case.
348
325
#
@@ -353,8 +330,7 @@ livepatch: '$MOD_LIVEPATCH': unpatching complete
353
330
# module. Post-patch callbacks are executed and the transition
354
331
# completes quickly.
355
332
356
- echo -n " TEST: multiple target modules ... "
357
- dmesg -C
333
+ start_test " multiple target modules"
358
334
359
335
load_mod $MOD_TARGET_BUSY block_transition=N
360
336
load_lp $MOD_LIVEPATCH
@@ -402,8 +378,6 @@ livepatch: '$MOD_LIVEPATCH': unpatching complete
402
378
$MOD_TARGET_BUSY : ${MOD_TARGET_BUSY} _exit"
403
379
404
380
405
- # TEST: busy target module
406
- #
407
381
# A similar test as the previous one, but force the "busy" kernel module
408
382
# to block the livepatch transition.
409
383
#
@@ -431,8 +405,7 @@ $MOD_TARGET_BUSY: ${MOD_TARGET_BUSY}_exit"
431
405
# klp_object's post-patch callbacks executed, the remaining
432
406
# klp_object's pre-unpatch callbacks are skipped.
433
407
434
- echo -n " TEST: busy target module ... "
435
- dmesg -C
408
+ start_test " busy target module"
436
409
437
410
load_mod $MOD_TARGET_BUSY block_transition=Y
438
411
load_lp_nowait $MOD_LIVEPATCH
@@ -478,17 +451,14 @@ $MOD_TARGET_BUSY: busymod_work_func exit
478
451
$MOD_TARGET_BUSY : ${MOD_TARGET_BUSY} _exit"
479
452
480
453
481
- # TEST: multiple livepatches
482
- #
483
454
# Test loading multiple livepatches. This test-case is mainly for comparing
484
455
# with the next test-case.
485
456
#
486
457
# - Load and unload two livepatches, pre and post (un)patch callbacks
487
458
# execute as each patch progresses through its (un)patching
488
459
# transition.
489
460
490
- echo -n " TEST: multiple livepatches ... "
491
- dmesg -C
461
+ start_test " multiple livepatches"
492
462
493
463
load_lp $MOD_LIVEPATCH
494
464
load_lp $MOD_LIVEPATCH2
@@ -531,8 +501,6 @@ livepatch: '$MOD_LIVEPATCH': unpatching complete
531
501
% rmmod $MOD_LIVEPATCH "
532
502
533
503
534
- # TEST: atomic replace
535
- #
536
504
# Load multiple livepatches, but the second as an 'atomic-replace'
537
505
# patch. When the latter loads, the original livepatch should be
538
506
# disabled and *none* of its pre/post-unpatch callbacks executed. On
@@ -547,8 +515,7 @@ livepatch: '$MOD_LIVEPATCH': unpatching complete
547
515
# - Once the atomic replace module is loaded, only its pre and post
548
516
# unpatch callbacks are executed.
549
517
550
- echo -n " TEST: atomic replace ... "
551
- dmesg -C
518
+ start_test " atomic replace"
552
519
553
520
load_lp $MOD_LIVEPATCH
554
521
load_lp $MOD_LIVEPATCH2 replace=1
0 commit comments