All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Lutomirski <luto@amacapital.net>
To: Kees Cook <keescook@chromium.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Andy Lutomirski <luto@kernel.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Chris Metcalf <cmetcalf@mellanox.com>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	Helge Deller <deller@gmx.de>,
	"James E.J. Bottomley" <jejb@parisc-linux.org>,
	James Hogan <james.hogan@imgtec.com>,
	Jeff Dike <jdike@addtoit.com>,
	linux-arch <linux-arch@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	Linux MIPS Mailing List <linux-mips@linux-mips.org>,
	linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	"linux-s390@vger.kernel.org" <linux-s390@vger.kernel.org>,
	"Maciej W. Rozycki" <macro@imgtec.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
Subject: Re: [PATCH 05/14] seccomp: recheck the syscall after RET_TRACE
Date: Thu, 9 Jun 2016 15:46:10 -0700	[thread overview]
Message-ID: <CALCETrUsqr3YbD=5mA9mRmgYqiHeEoLpWi-teyexUo_jR1BaFA@mail.gmail.com> (raw)
In-Reply-To: <1465506124-21866-6-git-send-email-keescook@chromium.org>

On Thu, Jun 9, 2016 at 2:01 PM, Kees Cook <keescook@chromium.org> wrote:
> When RET_TRACE triggers, a tracer may change a syscall into something that
> should be filtered by seccomp. This re-runs seccomp after a trace event
> to make sure things continue to pass.
>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> Cc: Andy Lutomirski <luto@kernel.org>
> ---
>  kernel/seccomp.c | 21 ++++++++++++++++++---
>  1 file changed, 18 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/seccomp.c b/kernel/seccomp.c
> index 14a37d71b612..54d15eb2b701 100644
> --- a/kernel/seccomp.c
> +++ b/kernel/seccomp.c
> @@ -556,7 +556,8 @@ void secure_computing_strict(int this_syscall)
>  #else
>
>  #ifdef CONFIG_SECCOMP_FILTER
> -static int __seccomp_filter(int this_syscall, const struct seccomp_data *sd)
> +static int __seccomp_filter(int this_syscall, const struct seccomp_data *sd,
> +                           const bool recheck_after_trace)

This patch looks good with one minor nit: I read this as "pass true if
you want to recheck after trace", which is exactly the opposite of how
it works.

--Andy

WARNING: multiple messages have this Message-ID (diff)
From: Andy Lutomirski <luto@amacapital.net>
To: Kees Cook <keescook@chromium.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Andy Lutomirski <luto@kernel.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Chris Metcalf <cmetcalf@mellanox.com>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	Helge Deller <deller@gmx.de>,
	"James E.J. Bottomley" <jejb@parisc-linux.org>,
	James Hogan <james.hogan@imgtec.com>,
	Jeff Dike <jdike@addtoit.com>,
	linux-arch <linux-arch@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	Linux MIPS Mailing List <linux-mips@linux-mips.org>,
	linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	"linux-s390@vger.kernel.org" <linux-s390@vger.kernel.org>,
	"Maciej W. Rozycki" <macro@imgtec.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Paul Mackerras <paulus@samba.org>,
	Ralf Baechle <ralf@linux-mips.org>,
	Richard Weinberger <richard@nod.at>,
	Russell King <linux@armlinux.org.uk>,
	"user-mode-linux-devel@lists.sourceforge.net" 
	<user-mode-linux-devel@lists.sourceforge.net>,
	Will Deacon <will.deacon@arm.com>, X86 ML <x86@kernel.org>
Subject: Re: [PATCH 05/14] seccomp: recheck the syscall after RET_TRACE
Date: Thu, 9 Jun 2016 15:46:10 -0700	[thread overview]
Message-ID: <CALCETrUsqr3YbD=5mA9mRmgYqiHeEoLpWi-teyexUo_jR1BaFA@mail.gmail.com> (raw)
In-Reply-To: <1465506124-21866-6-git-send-email-keescook@chromium.org>

On Thu, Jun 9, 2016 at 2:01 PM, Kees Cook <keescook@chromium.org> wrote:
> When RET_TRACE triggers, a tracer may change a syscall into something that
> should be filtered by seccomp. This re-runs seccomp after a trace event
> to make sure things continue to pass.
>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> Cc: Andy Lutomirski <luto@kernel.org>
> ---
>  kernel/seccomp.c | 21 ++++++++++++++++++---
>  1 file changed, 18 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/seccomp.c b/kernel/seccomp.c
> index 14a37d71b612..54d15eb2b701 100644
> --- a/kernel/seccomp.c
> +++ b/kernel/seccomp.c
> @@ -556,7 +556,8 @@ void secure_computing_strict(int this_syscall)
>  #else
>
>  #ifdef CONFIG_SECCOMP_FILTER
> -static int __seccomp_filter(int this_syscall, const struct seccomp_data *sd)
> +static int __seccomp_filter(int this_syscall, const struct seccomp_data *sd,
> +                           const bool recheck_after_trace)

This patch looks good with one minor nit: I read this as "pass true if
you want to recheck after trace", which is exactly the opposite of how
it works.

--Andy

WARNING: multiple messages have this Message-ID (diff)
From: Andy Lutomirski <luto@amacapital.net>
To: Kees Cook <keescook@chromium.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Andy Lutomirski <luto@kernel.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Chris Metcalf <cmetcalf@mellanox.com>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	Helge Deller <deller@gmx.de>,
	"James E.J. Bottomley" <jejb@parisc-linux.org>,
	James Hogan <james.hogan@imgtec.com>,
	Jeff Dike <jdike@addtoit.com>,
	linux-arch <linux-arch@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	Linux MIPS Mailing List <linux-mips@linux-mips.org>,
	linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	"linux-s390@vger.kernel.org" <linux-s390@vger.kernel.org>,
	"Maciej W. Rozycki" <macro@imgtec.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	Michael Ellerman <mpe@ellerman.id.au>
Subject: Re: [PATCH 05/14] seccomp: recheck the syscall after RET_TRACE
Date: Thu, 9 Jun 2016 15:46:10 -0700	[thread overview]
Message-ID: <CALCETrUsqr3YbD=5mA9mRmgYqiHeEoLpWi-teyexUo_jR1BaFA@mail.gmail.com> (raw)
In-Reply-To: <1465506124-21866-6-git-send-email-keescook@chromium.org>

On Thu, Jun 9, 2016 at 2:01 PM, Kees Cook <keescook@chromium.org> wrote:
> When RET_TRACE triggers, a tracer may change a syscall into something that
> should be filtered by seccomp. This re-runs seccomp after a trace event
> to make sure things continue to pass.
>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> Cc: Andy Lutomirski <luto@kernel.org>
> ---
>  kernel/seccomp.c | 21 ++++++++++++++++++---
>  1 file changed, 18 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/seccomp.c b/kernel/seccomp.c
> index 14a37d71b612..54d15eb2b701 100644
> --- a/kernel/seccomp.c
> +++ b/kernel/seccomp.c
> @@ -556,7 +556,8 @@ void secure_computing_strict(int this_syscall)
>  #else
>
>  #ifdef CONFIG_SECCOMP_FILTER
> -static int __seccomp_filter(int this_syscall, const struct seccomp_data *sd)
> +static int __seccomp_filter(int this_syscall, const struct seccomp_data *sd,
> +                           const bool recheck_after_trace)

This patch looks good with one minor nit: I read this as "pass true if
you want to recheck after trace", which is exactly the opposite of how
it works.

--Andy

WARNING: multiple messages have this Message-ID (diff)
From: Andy Lutomirski <luto@amacapital.net>
To: Kees Cook <keescook@chromium.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Andy Lutomirski <luto@kernel.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Chris Metcalf <cmetcalf@mellanox.com>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	Helge Deller <deller@gmx.de>,
	"James E.J. Bottomley" <jejb@parisc-linux.org>,
	James Hogan <james.hogan@imgtec.com>,
	Jeff Dike <jdike@addtoit.com>,
	linux-arch <linux-arch@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	Linux MIPS Mailing List <linux-mips@linux-mips.org>,
	linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	"linux-s390@vger.kernel.org" <linux-s390@vger.kernel.org>,
	"Maciej W. Rozycki" <macro@imgtec.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Paul Mackerras <paulus@samba.org>,
	Ralf Baechle <ralf@linux-mips.org>,
	Richard Weinberger <richard@nod.at>,
	Russell King <linux@armlinux.org.uk>,
	"user-mode-linux-devel@lists.sourceforge.net"
	<user-mode-linux-devel@lists.sourceforge.net>,
	Will Deacon <will.deacon@arm.com>, X86 ML <x86@kernel.org>
Subject: Re: [PATCH 05/14] seccomp: recheck the syscall after RET_TRACE
Date: Thu, 9 Jun 2016 15:46:10 -0700	[thread overview]
Message-ID: <CALCETrUsqr3YbD=5mA9mRmgYqiHeEoLpWi-teyexUo_jR1BaFA@mail.gmail.com> (raw)
Message-ID: <20160609224610.h_g6aSO7UDZiprO3Vkxs_u-fJlZgCYtPcNQ1UmrJn1Q@z> (raw)
In-Reply-To: <1465506124-21866-6-git-send-email-keescook@chromium.org>

On Thu, Jun 9, 2016 at 2:01 PM, Kees Cook <keescook@chromium.org> wrote:
> When RET_TRACE triggers, a tracer may change a syscall into something that
> should be filtered by seccomp. This re-runs seccomp after a trace event
> to make sure things continue to pass.
>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> Cc: Andy Lutomirski <luto@kernel.org>
> ---
>  kernel/seccomp.c | 21 ++++++++++++++++++---
>  1 file changed, 18 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/seccomp.c b/kernel/seccomp.c
> index 14a37d71b612..54d15eb2b701 100644
> --- a/kernel/seccomp.c
> +++ b/kernel/seccomp.c
> @@ -556,7 +556,8 @@ void secure_computing_strict(int this_syscall)
>  #else
>
>  #ifdef CONFIG_SECCOMP_FILTER
> -static int __seccomp_filter(int this_syscall, const struct seccomp_data *sd)
> +static int __seccomp_filter(int this_syscall, const struct seccomp_data *sd,
> +                           const bool recheck_after_trace)

This patch looks good with one minor nit: I read this as "pass true if
you want to recheck after trace", which is exactly the opposite of how
it works.

--Andy

WARNING: multiple messages have this Message-ID (diff)
From: luto@amacapital.net (Andy Lutomirski)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 05/14] seccomp: recheck the syscall after RET_TRACE
Date: Thu, 9 Jun 2016 15:46:10 -0700	[thread overview]
Message-ID: <CALCETrUsqr3YbD=5mA9mRmgYqiHeEoLpWi-teyexUo_jR1BaFA@mail.gmail.com> (raw)
In-Reply-To: <1465506124-21866-6-git-send-email-keescook@chromium.org>

On Thu, Jun 9, 2016 at 2:01 PM, Kees Cook <keescook@chromium.org> wrote:
> When RET_TRACE triggers, a tracer may change a syscall into something that
> should be filtered by seccomp. This re-runs seccomp after a trace event
> to make sure things continue to pass.
>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> Cc: Andy Lutomirski <luto@kernel.org>
> ---
>  kernel/seccomp.c | 21 ++++++++++++++++++---
>  1 file changed, 18 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/seccomp.c b/kernel/seccomp.c
> index 14a37d71b612..54d15eb2b701 100644
> --- a/kernel/seccomp.c
> +++ b/kernel/seccomp.c
> @@ -556,7 +556,8 @@ void secure_computing_strict(int this_syscall)
>  #else
>
>  #ifdef CONFIG_SECCOMP_FILTER
> -static int __seccomp_filter(int this_syscall, const struct seccomp_data *sd)
> +static int __seccomp_filter(int this_syscall, const struct seccomp_data *sd,
> +                           const bool recheck_after_trace)

This patch looks good with one minor nit: I read this as "pass true if
you want to recheck after trace", which is exactly the opposite of how
it works.

--Andy

  reply	other threads:[~2016-06-09 22:46 UTC|newest]

Thread overview: 96+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-09 21:01 [PATCH 00/14] run seccomp after ptrace Kees Cook
2016-06-09 21:01 ` Kees Cook
2016-06-09 21:01 ` Kees Cook
2016-06-09 21:01 ` Kees Cook
2016-06-09 21:01 ` [PATCH 01/14] seccomp: add tests for ptrace hole Kees Cook
2016-06-09 21:01   ` Kees Cook
2016-06-09 21:01   ` Kees Cook
2016-06-09 21:01   ` Kees Cook
2016-06-09 21:01   ` Kees Cook
2016-06-09 21:01 ` [PATCH 02/14] seccomp: Add a seccomp_data parameter secure_computing() Kees Cook
2016-06-09 21:01   ` Kees Cook
2016-06-09 21:01   ` Kees Cook
2016-06-09 21:01   ` Kees Cook
2016-06-09 21:01   ` Kees Cook
2016-06-09 21:01 ` [PATCH 03/14] x86/entry: Get rid of two-phase syscall entry work Kees Cook
2016-06-09 21:01   ` Kees Cook
2016-06-09 21:01   ` Kees Cook
2016-06-09 21:01   ` Kees Cook
2016-06-09 21:01 ` [PATCH 04/14] seccomp: remove 2-phase API Kees Cook
2016-06-09 21:01   ` Kees Cook
2016-06-09 21:01   ` Kees Cook
2016-06-09 21:01   ` Kees Cook
2016-06-09 21:01 ` [PATCH 05/14] seccomp: recheck the syscall after RET_TRACE Kees Cook
2016-06-09 21:01   ` Kees Cook
2016-06-09 21:01   ` Kees Cook
2016-06-09 21:01   ` Kees Cook
2016-06-09 22:46   ` Andy Lutomirski [this message]
2016-06-09 22:46     ` Andy Lutomirski
2016-06-09 22:46     ` Andy Lutomirski
2016-06-09 22:46     ` Andy Lutomirski
2016-06-09 22:46     ` Andy Lutomirski
2016-06-09 21:01 ` [PATCH 06/14] x86/ptrace: run seccomp after ptrace Kees Cook
2016-06-09 21:01   ` Kees Cook
2016-06-09 21:01   ` Kees Cook
2016-06-09 21:01   ` Kees Cook
2016-06-09 21:01   ` Kees Cook
2016-06-09 22:52   ` Andy Lutomirski
2016-06-09 22:52     ` Andy Lutomirski
2016-06-09 22:52     ` Andy Lutomirski
2016-06-09 22:52     ` Andy Lutomirski
2016-06-09 22:52     ` Andy Lutomirski
2016-06-10  2:01     ` Kees Cook
2016-06-10  2:01       ` Kees Cook
2016-06-10  2:01       ` Kees Cook
2016-06-10  2:01       ` Kees Cook
2016-06-10  2:01       ` Kees Cook
2016-06-14  2:27     ` Andy Lutomirski
2016-06-14  2:27       ` Andy Lutomirski
2016-06-14  2:27       ` Andy Lutomirski
2016-06-14  2:27       ` Andy Lutomirski
2016-06-14  2:27       ` Andy Lutomirski
2016-06-09 21:01 ` [PATCH 07/14] arm/ptrace: " Kees Cook
2016-06-09 21:01   ` Kees Cook
2016-06-09 21:01   ` Kees Cook
2016-06-09 21:01   ` Kees Cook
2016-06-09 21:01 ` [PATCH 08/14] arm64/ptrace: " Kees Cook
2016-06-09 21:01   ` Kees Cook
2016-06-09 21:01   ` Kees Cook
2016-06-09 21:01   ` Kees Cook
2016-06-09 21:01   ` Kees Cook
2016-06-09 21:01 ` [PATCH 09/14] MIPS/ptrace: " Kees Cook
2016-06-09 21:01   ` Kees Cook
2016-06-09 21:01   ` Kees Cook
2016-06-09 21:01   ` Kees Cook
2016-06-09 21:02 ` [PATCH 10/14] parisc/ptrace: " Kees Cook
2016-06-09 21:02   ` Kees Cook
2016-06-09 21:02   ` Kees Cook
2016-06-09 21:02   ` Kees Cook
2016-06-09 21:02   ` Kees Cook
2016-06-09 21:02 ` [PATCH 11/14] s390/ptrace: " Kees Cook
2016-06-09 21:02   ` Kees Cook
2016-06-09 21:02   ` Kees Cook
2016-06-09 21:02   ` Kees Cook
2016-06-09 21:02   ` Kees Cook
2016-06-10 10:51   ` Martin Schwidefsky
2016-06-10 10:51     ` Martin Schwidefsky
2016-06-10 10:51     ` Martin Schwidefsky
2016-06-09 21:02 ` [PATCH 12/14] powerpc/ptrace: " Kees Cook
2016-06-09 21:02   ` Kees Cook
2016-06-09 21:02   ` Kees Cook
2016-06-09 21:02   ` Kees Cook
2016-06-09 21:02 ` [PATCH 13/14] tile/ptrace: " Kees Cook
2016-06-09 21:02   ` Kees Cook
2016-06-09 21:02   ` Kees Cook
2016-06-09 21:02   ` Kees Cook
2016-06-09 21:02   ` Kees Cook
2016-06-09 21:02 ` [PATCH 14/14] um/ptrace: " Kees Cook
2016-06-09 21:02   ` Kees Cook
2016-06-09 21:02   ` Kees Cook
2016-06-09 21:02   ` Kees Cook
2016-06-09 21:02   ` Kees Cook
2016-06-13 20:50 ` [PATCH 00/14] " Kees Cook
2016-06-13 20:50   ` Kees Cook
2016-06-13 20:50   ` Kees Cook
2016-06-13 20:50   ` Kees Cook
2016-06-13 20:50   ` Kees Cook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALCETrUsqr3YbD=5mA9mRmgYqiHeEoLpWi-teyexUo_jR1BaFA@mail.gmail.com' \
    --to=luto@amacapital.net \
    --cc=benh@kernel.crashing.org \
    --cc=catalin.marinas@arm.com \
    --cc=cmetcalf@mellanox.com \
    --cc=deller@gmx.de \
    --cc=heiko.carstens@de.ibm.com \
    --cc=james.hogan@imgtec.com \
    --cc=jdike@addtoit.com \
    --cc=jejb@parisc-linux.org \
    --cc=keescook@chromium.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=luto@kernel.org \
    --cc=macro@imgtec.com \
    --cc=mark.rutland@arm.com \
    --cc=mpe@ellerman.id.au \
    --cc=schwidefsky@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.