[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200519083044.lo5d22hdd5nc3dcm@wittgenstein>
Date: Tue, 19 May 2020 10:30:44 +0200
From: Christian Brauner <christian.brauner@...ntu.com>
To: Sargun Dhillon <sargun@...gun.me>
Cc: Jann Horn <jannh@...gle.com>, Kees Cook <keescook@...omium.org>,
Tycho Andersen <tycho@...ho.ws>,
Matt Denton <mpdenton@...gle.com>,
Chris Palmer <palmer@...gle.com>,
Jeffrey Vander Stoep <jeffv@...gle.com>,
Linux Containers <containers@...ts.linux-foundation.org>,
Linux API <linux-api@...r.kernel.org>,
kernel list <linux-kernel@...r.kernel.org>
Subject: Re: seccomp feature development
On Tue, May 19, 2020 at 07:24:52AM +0000, Sargun Dhillon wrote:
> On Tue, May 19, 2020 at 12:39:39AM +0200, Jann Horn wrote:
> > > For user_notif, I think we need something in and around these options:
> > >
> > > - make a new API that explicitly follows EA struct design
> > > (and while read()/write() might be easier[4], I tend to agree with
> > > Jann and we need to stick to ioctl(): as Tycho noted, "read/write is
> > > for data". Though I wonder if read() could be used for the notifications,
> > > which ARE data, and use ioctl() for the responses?)
> >
> > Just as a note: If we use read() there, we'll never be able to
> > transfer things like FDs through that API.
(Hm, how did I not get that message? Weird. :))
I hope we won't be able to receive fds through read(). This quickly
becomes quite problematic, I think.
> >
> Although there is no good reason for read being able to receive FDs, there is
> precedence for recvmsg being able to do this. Either way, I do not think
Right, and recvmsg() is quite dangerous because of that because you need
to be extremely careful when e.g. the message is truncated and you want
to error out and you need to carefully close all fds and other shenanigans.
Also, recvmsg() imho, is a bit different from read simply because
it's sort-of a "typed" read; it's plumbed on top of a message protocol and
that protocal includes the ability to read fds. read() on the other hand
is completely agnostic and doesn't care about the data at all. But
that's just how I always conceptualized it...
> it's a good idea to recv file descriptors, and instead file descriptors
> should be fetched via the pidfd_getfd syscall.
+1
>
> Injection is more complicated, and for now, I believe that "writes" should
> be done via ioctl, or in the future, something like sendmsg might work.
Powered by blists - more mailing lists