Re: [RFC PATCH v1.9 12/14] livepatch: create per-task consistency model

From: Miroslav Benes
Date: Thu Mar 31 2016 - 09:12:50 EST


On Fri, 25 Mar 2016, Josh Poimboeuf wrote:

[...]

> diff --git a/kernel/fork.c b/kernel/fork.c
> index d277e83..27b181e 100644
> --- a/kernel/fork.c
> +++ b/kernel/fork.c
> @@ -76,6 +76,7 @@
> #include <linux/compiler.h>
> #include <linux/sysctl.h>
> #include <linux/kcov.h>
> +#include <linux/livepatch.h>
>
> #include <asm/pgtable.h>
> #include <asm/pgalloc.h>
> @@ -1615,6 +1616,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
> total_forks++;
> spin_unlock(&current->sighand->siglock);
> syscall_tracepoint_update(p);
> + klp_update_task_universe(p);

Shouldn't we copy transition and TIF from the parent? I deal with a race
in kgraft and the solution seems to be this code exactly at this place in
copy_process(). I need to think about it.

[...]

> +static void klp_schedule_work(void)
> +{
> + if (IS_ENABLED(CONFIG_RELIABLE_STACKTRACE))
> + schedule_delayed_work(&klp_work, round_jiffies_relative(HZ));
> +}

As mentioned in my cover letter reply I'd allow to schedule delayed work
even for !CONFIG_RELIABLE_STACKTRACE archs and configurations. There is a
check in klp_try_switch_task() for CONFIG_RELIABLE_STACKTRACE so the
change should be trivial. The patching could be successful even without
reliable stack traces especially in combination with a fake signal and
a syscall boundary migration.

Miroslav