Skip to content

Commit

Permalink
livepatch: add transition notices
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
joe-lawrence authored and Jiri Kosina committed Oct 19, 2017
1 parent 6116c30 commit af02679
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion kernel/livepatch/transition.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ static void klp_complete_transition(void)
unsigned int cpu;
bool immediate_func = false;

pr_debug("'%s': completing %s transition\n",
klp_transition_patch->mod->name,
klp_target_state == KLP_PATCHED ? "patching" : "unpatching");

if (klp_target_state == KLP_UNPATCHED) {
/*
* All tasks have transitioned to KLP_UNPATCHED so we can now
Expand Down Expand Up @@ -163,6 +167,9 @@ void klp_cancel_transition(void)
if (WARN_ON_ONCE(klp_target_state != KLP_PATCHED))
return;

pr_debug("'%s': canceling patching transition, going to unpatch\n",
klp_transition_patch->mod->name);

klp_target_state = KLP_UNPATCHED;
klp_complete_transition();
}
Expand Down Expand Up @@ -441,7 +448,8 @@ void klp_start_transition(void)

WARN_ON_ONCE(klp_target_state == KLP_UNDEFINED);

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

/*
Expand Down Expand Up @@ -497,6 +505,9 @@ void klp_init_transition(struct klp_patch *patch, int state)
*/
klp_target_state = state;

pr_debug("'%s': initializing %s transition\n", patch->mod->name,
klp_target_state == KLP_PATCHED ? "patching" : "unpatching");

/*
* If the patch can be applied or reverted immediately, skip the
* per-task transitions.
Expand Down Expand Up @@ -562,6 +573,11 @@ void klp_reverse_transition(void)
unsigned int cpu;
struct task_struct *g, *task;

pr_debug("'%s': reversing transition from %s\n",
klp_transition_patch->mod->name,
klp_target_state == KLP_PATCHED ? "patching to unpatching" :
"unpatching to patching");

klp_transition_patch->enabled = !klp_transition_patch->enabled;

klp_target_state = !klp_target_state;
Expand Down

0 comments on commit af02679

Please sign in to comment.