Skip to content

Commit af02679

Browse files
joe-lawrenceJiri Kosina
authored andcommitted
livepatch: add transition notices
Log a few kernel debug messages at the beginning of the following livepatch transition functions: klp_complete_transition() klp_cancel_transition() klp_init_transition() klp_reverse_transition() Also update the log notice message in klp_start_transition() for similar verbiage as the above messages. Suggested-by: Josh Poimboeuf <[email protected]> Signed-off-by: Joe Lawrence <[email protected]> Acked-by: Miroslav Benes <[email protected]> Acked-by: Josh Poimboeuf <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 6116c30 commit af02679

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

kernel/livepatch/transition.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ static void klp_complete_transition(void)
8282
unsigned int cpu;
8383
bool immediate_func = false;
8484

85+
pr_debug("'%s': completing %s transition\n",
86+
klp_transition_patch->mod->name,
87+
klp_target_state == KLP_PATCHED ? "patching" : "unpatching");
88+
8589
if (klp_target_state == KLP_UNPATCHED) {
8690
/*
8791
* All tasks have transitioned to KLP_UNPATCHED so we can now
@@ -163,6 +167,9 @@ void klp_cancel_transition(void)
163167
if (WARN_ON_ONCE(klp_target_state != KLP_PATCHED))
164168
return;
165169

170+
pr_debug("'%s': canceling patching transition, going to unpatch\n",
171+
klp_transition_patch->mod->name);
172+
166173
klp_target_state = KLP_UNPATCHED;
167174
klp_complete_transition();
168175
}
@@ -441,7 +448,8 @@ void klp_start_transition(void)
441448

442449
WARN_ON_ONCE(klp_target_state == KLP_UNDEFINED);
443450

444-
pr_notice("'%s': %s...\n", klp_transition_patch->mod->name,
451+
pr_notice("'%s': starting %s transition\n",
452+
klp_transition_patch->mod->name,
445453
klp_target_state == KLP_PATCHED ? "patching" : "unpatching");
446454

447455
/*
@@ -497,6 +505,9 @@ void klp_init_transition(struct klp_patch *patch, int state)
497505
*/
498506
klp_target_state = state;
499507

508+
pr_debug("'%s': initializing %s transition\n", patch->mod->name,
509+
klp_target_state == KLP_PATCHED ? "patching" : "unpatching");
510+
500511
/*
501512
* If the patch can be applied or reverted immediately, skip the
502513
* per-task transitions.
@@ -562,6 +573,11 @@ void klp_reverse_transition(void)
562573
unsigned int cpu;
563574
struct task_struct *g, *task;
564575

576+
pr_debug("'%s': reversing transition from %s\n",
577+
klp_transition_patch->mod->name,
578+
klp_target_state == KLP_PATCHED ? "patching to unpatching" :
579+
"unpatching to patching");
580+
565581
klp_transition_patch->enabled = !klp_transition_patch->enabled;
566582

567583
klp_target_state = !klp_target_state;

0 commit comments

Comments
 (0)