Re: [RFC PATCH 9/9] livepatch: update task universe when exiting kernel

From: Jiri Slaby
Date: Mon Feb 16 2015 - 05:16:19 EST


On 02/09/2015, 06:31 PM, Josh Poimboeuf wrote:
> Update a tasks's universe when returning from a system call or user
> space interrupt, or after handling a signal.
>
> This greatly increases the chances of a patch operation succeeding. If
> a task is I/O bound, it can switch universes when returning from a
> system call. If a task is CPU bound, it can switch universes when
> returning from an interrupt. If a task is sleeping on a to-be-patched
> function, the user can send SIGSTOP and SIGCONT to force it to switch.
>
> Since the idle "swapper" tasks don't ever exit the kernel, they're
> updated from within the idle loop.
>
> Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
> ---
> arch/x86/include/asm/thread_info.h | 4 +++-
> arch/x86/kernel/signal.c | 4 ++++
> include/linux/livepatch.h | 2 ++
> kernel/livepatch/transition.c | 15 +++++++++++++++
> kernel/sched/idle.c | 4 ++++
...
> --- a/kernel/sched/idle.c
> +++ b/kernel/sched/idle.c
> @@ -7,6 +7,7 @@
> #include <linux/tick.h>
> #include <linux/mm.h>
> #include <linux/stackprotector.h>
> +#include <linux/livepatch.h>
>
> #include <asm/tlb.h>
>
> @@ -250,6 +251,9 @@ static void cpu_idle_loop(void)
>
> sched_ttwu_pending();
> schedule_preempt_disabled();
> +
> + if (unlikely(test_thread_flag(TIF_KLP_NEED_UPDATE)))
> + klp_update_task_universe(current);

Oh, this is indeed broken on non-x86 archs as kbuild reports.
(TIF_KLP_NEED_UPDATE undefined)

We need a klp_maybe_update_task_universe inline or something like that
and define it void for non-LIVEPATCH configs.

regards,
--
js
suse labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/