Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1234450 > unrolled thread

Re: [PATCH v7 04/11] task_isolation: provide strict mode configurable signal

Started byAndy Lutomirski <luto@amacapital.net>
First post2015-09-28 23:00 +0200
Last post2015-09-28 23:00 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v7 04/11] task_isolation: provide strict mode configurable signal Andy Lutomirski <luto@amacapital.net> - 2015-09-28 23:00 +0200

#1234450 — Re: [PATCH v7 04/11] task_isolation: provide strict mode configurable signal

FromAndy Lutomirski <luto@amacapital.net>
Date2015-09-28 23:00 +0200
SubjectRe: [PATCH v7 04/11] task_isolation: provide strict mode configurable signal
Message-ID<qdNGH-2fW-23@gated-at.bofh.it>
On Mon, Sep 28, 2015 at 11:17 AM, Chris Metcalf <cmetcalf@ezchip.com> wrote:
> Allow userspace to override the default SIGKILL delivered
> when a task_isolation process in STRICT mode does a syscall
> or otherwise synchronously enters the kernel.
>
> In addition to being able to set the signal, we now also
> pass whether or not the interruption was from a syscall in
> the si_code field of the siginfo.
>
> Signed-off-by: Chris Metcalf <cmetcalf@ezchip.com>
> ---
>  include/uapi/linux/prctl.h |  2 ++
>  kernel/isolation.c         | 17 +++++++++++++----
>  2 files changed, 15 insertions(+), 4 deletions(-)
>
> diff --git a/include/uapi/linux/prctl.h b/include/uapi/linux/prctl.h
> index 2b8038b0d1e1..a5582ace987f 100644
> --- a/include/uapi/linux/prctl.h
> +++ b/include/uapi/linux/prctl.h
> @@ -202,5 +202,7 @@ struct prctl_mm_map {
>  #define PR_GET_TASK_ISOLATION          49
>  # define PR_TASK_ISOLATION_ENABLE      (1 << 0)
>  # define PR_TASK_ISOLATION_STRICT      (1 << 1)
> +# define PR_TASK_ISOLATION_SET_SIG(sig)        (((sig) & 0x7f) << 8)
> +# define PR_TASK_ISOLATION_GET_SIG(bits) (((bits) >> 8) & 0x7f)
>
>  #endif /* _LINUX_PRCTL_H */
> diff --git a/kernel/isolation.c b/kernel/isolation.c
> index 3779ba670472..44bafcd08bca 100644
> --- a/kernel/isolation.c
> +++ b/kernel/isolation.c
> @@ -77,14 +77,23 @@ void task_isolation_enter(void)
>         }
>  }
>
> -static void kill_task_isolation_strict_task(void)
> +static void kill_task_isolation_strict_task(int is_syscall)
>  {
> +       siginfo_t info = {};
> +       int sig;
> +
>         /* RCU should have been enabled prior to this point. */
>         RCU_LOCKDEP_WARN(!rcu_is_watching(), "kernel entry without RCU");
>
>         dump_stack();
>         current->task_isolation_flags &= ~PR_TASK_ISOLATION_ENABLE;
> -       send_sig(SIGKILL, current, 1);
> +
> +       sig = PR_TASK_ISOLATION_GET_SIG(current->task_isolation_flags);
> +       if (sig == 0)
> +               sig = SIGKILL;
> +       info.si_signo = sig;
> +       info.si_code = is_syscall;

I think this needs real SI_ defines.

> +       send_sig_info(sig, &info, current);
>  }
>
>  /*
> @@ -103,7 +112,7 @@ void task_isolation_syscall(int syscall)
>
>         pr_warn("%s/%d: task_isolation strict mode violated by syscall %d\n",
>                 current->comm, current->pid, syscall);
> -       kill_task_isolation_strict_task();
> +       kill_task_isolation_strict_task(1);

No magic numbers please.

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

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web