aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/livepatch/transition.c
diff options
context:
space:
mode:
authorMiroslav Benes <mbenes@suse.cz>2019-01-15 11:45:07 -0500
committerJiri Kosina <jkosina@suse.cz>2019-01-16 16:09:33 -0500
commit0b3d52790e1cfd6b80b826a245d24859e89632f7 (patch)
tree8a804f975eeacddea0add44d9b2ad912a9fbc636 /kernel/livepatch/transition.c
parentcba82dea30613346cf9a0532a41fc118bc3263af (diff)
livepatch: Remove signal sysfs attribute
The fake signal is send automatically now. We can rely on it completely and remove the sysfs attribute. Signed-off-by: Miroslav Benes <mbenes@suse.cz> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'kernel/livepatch/transition.c')
-rw-r--r--kernel/livepatch/transition.c82
1 files changed, 41 insertions, 41 deletions
diff --git a/kernel/livepatch/transition.c b/kernel/livepatch/transition.c
index ea7697bb753e..183b2086ba03 100644
--- a/kernel/livepatch/transition.c
+++ b/kernel/livepatch/transition.c
@@ -348,6 +348,47 @@ done:
348} 348}
349 349
350/* 350/*
351 * Sends a fake signal to all non-kthread tasks with TIF_PATCH_PENDING set.
352 * Kthreads with TIF_PATCH_PENDING set are woken up.
353 */
354static void klp_send_signals(void)
355{
356 struct task_struct *g, *task;
357
358 if (klp_signals_cnt == SIGNALS_TIMEOUT)
359 pr_notice("signaling remaining tasks\n");
360
361 read_lock(&tasklist_lock);
362 for_each_process_thread(g, task) {
363 if (!klp_patch_pending(task))
364 continue;
365
366 /*
367 * There is a small race here. We could see TIF_PATCH_PENDING
368 * set and decide to wake up a kthread or send a fake signal.
369 * Meanwhile the task could migrate itself and the action
370 * would be meaningless. It is not serious though.
371 */
372 if (task->flags & PF_KTHREAD) {
373 /*
374 * Wake up a kthread which sleeps interruptedly and
375 * still has not been migrated.
376 */
377 wake_up_state(task, TASK_INTERRUPTIBLE);
378 } else {
379 /*
380 * Send fake signal to all non-kthread tasks which are
381 * still not migrated.
382 */
383 spin_lock_irq(&task->sighand->siglock);
384 signal_wake_up(task, 0);
385 spin_unlock_irq(&task->sighand->siglock);
386 }
387 }
388 read_unlock(&tasklist_lock);
389}
390
391/*
351 * Try to switch all remaining tasks to the target patch state by walking the 392 * Try to switch all remaining tasks to the target patch state by walking the
352 * stacks of sleeping tasks and looking for any to-be-patched or 393 * stacks of sleeping tasks and looking for any to-be-patched or
353 * to-be-unpatched functions. If such functions are found, the task can't be 394 * to-be-unpatched functions. If such functions are found, the task can't be
@@ -587,47 +628,6 @@ void klp_copy_process(struct task_struct *child)
587} 628}
588 629
589/* 630/*
590 * Sends a fake signal to all non-kthread tasks with TIF_PATCH_PENDING set.
591 * Kthreads with TIF_PATCH_PENDING set are woken up.
592 */
593void klp_send_signals(void)
594{
595 struct task_struct *g, *task;
596
597 if (klp_signals_cnt == SIGNALS_TIMEOUT)
598 pr_notice("signaling remaining tasks\n");
599
600 read_lock(&tasklist_lock);
601 for_each_process_thread(g, task) {
602 if (!klp_patch_pending(task))
603 continue;
604
605 /*
606 * There is a small race here. We could see TIF_PATCH_PENDING
607 * set and decide to wake up a kthread or send a fake signal.
608 * Meanwhile the task could migrate itself and the action
609 * would be meaningless. It is not serious though.
610 */
611 if (task->flags & PF_KTHREAD) {
612 /*
613 * Wake up a kthread which sleeps interruptedly and
614 * still has not been migrated.
615 */
616 wake_up_state(task, TASK_INTERRUPTIBLE);
617 } else {
618 /*
619 * Send fake signal to all non-kthread tasks which are
620 * still not migrated.
621 */
622 spin_lock_irq(&task->sighand->siglock);
623 signal_wake_up(task, 0);
624 spin_unlock_irq(&task->sighand->siglock);
625 }
626 }
627 read_unlock(&tasklist_lock);
628}
629
630/*
631 * Drop TIF_PATCH_PENDING of all tasks on admin's request. This forces an 631 * Drop TIF_PATCH_PENDING of all tasks on admin's request. This forces an
632 * existing transition to finish. 632 * existing transition to finish.
633 * 633 *