[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200616161859.GL2893648@cisco>
Date: Tue, 16 Jun 2020 10:18:59 -0600
From: Tycho Andersen <tycho@...ho.ws>
To: Kees Cook <keescook@...omium.org>
Cc: linux-kernel@...r.kernel.org, Sargun Dhillon <sargun@...gun.me>,
Christian Brauner <christian@...uner.io>,
"David S. Miller" <davem@...emloft.net>,
Christoph Hellwig <hch@....de>,
Jakub Kicinski <kuba@...nel.org>,
Alexander Viro <viro@...iv.linux.org.uk>,
Aleksa Sarai <cyphar@...har.com>,
Matt Denton <mpdenton@...gle.com>,
Jann Horn <jannh@...gle.com>, Chris Palmer <palmer@...gle.com>,
Robert Sesek <rsesek@...gle.com>,
Giuseppe Scrivano <gscrivan@...hat.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Andy Lutomirski <luto@...capital.net>,
Will Drewry <wad@...omium.org>, Shuah Khan <shuah@...nel.org>,
netdev@...r.kernel.org, containers@...ts.linux-foundation.org,
linux-api@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-kselftest@...r.kernel.org
Subject: Re: [PATCH v4 10/11] seccomp: Switch addfd to Extensible Argument
ioctl
On Tue, Jun 16, 2020 at 09:05:29AM -0700, Kees Cook wrote:
> On Tue, Jun 16, 2020 at 08:55:46AM -0600, Tycho Andersen wrote:
> > On Mon, Jun 15, 2020 at 08:25:23PM -0700, Kees Cook wrote:
> > > This patch is based on discussions[1] with Sargun Dhillon, Christian
> > > Brauner, and David Laight. Instead of building size into the addfd
> > > structure, make it a function of the ioctl command (which is how sizes are
> > > normally passed to ioctls). To support forward and backward compatibility,
> > > just mask out the direction and size, and match everything. The size (and
> > > any future direction) checks are done along with copy_struct_from_user()
> > > logic. Also update the selftests to check size bounds.
> > >
> > > [1] https://lore.kernel.org/lkml/20200612104629.GA15814@ircssh-2.c.rugged-nimbus-611.internal
> > >
> > > Signed-off-by: Kees Cook <keescook@...omium.org>
> > > ---
> > > include/uapi/linux/seccomp.h | 2 -
> > > kernel/seccomp.c | 21 ++++++----
> > > tools/testing/selftests/seccomp/seccomp_bpf.c | 40 ++++++++++++++++---
> > > 3 files changed, 49 insertions(+), 14 deletions(-)
> > >
> > > diff --git a/include/uapi/linux/seccomp.h b/include/uapi/linux/seccomp.h
> > > index c347160378e5..473a61695ac3 100644
> > > --- a/include/uapi/linux/seccomp.h
> > > +++ b/include/uapi/linux/seccomp.h
> > > @@ -118,7 +118,6 @@ struct seccomp_notif_resp {
> > >
> > > /**
> > > * struct seccomp_notif_addfd
> > > - * @size: The size of the seccomp_notif_addfd structure
> > > * @id: The ID of the seccomp notification
> > > * @flags: SECCOMP_ADDFD_FLAG_*
> > > * @srcfd: The local fd number
> > > @@ -126,7 +125,6 @@ struct seccomp_notif_resp {
> > > * @newfd_flags: The O_* flags the remote FD should have applied
> > > */
> > > struct seccomp_notif_addfd {
> > > - __u64 size;
> >
> > Huh? Won't this break builds?
>
> Only if they use addfd without this patch? :) Are you saying I should
> collapse this patch into the main addfd and test patches?
Oh, derp, I see :) Yeah, maybe that would be good.
Tycho
Powered by blists - more mailing lists