On Sat, 5 Dec 2026 at 10:14, Christian Brauner <brau…@kernel.org> wrote:
>
> On Sat, Dec 05, 2026 at 01:42:24AM +0000, Luca Boccassi wrote:
> > On Sat, 5 Dec 2026 at 01:29, Kuniyuki Iwashima <kuni…@google.com> wrote:
> > >
> > > On Sat, 05 Dec 2026 01:15:00 +0000, Luca Boccassi wrote:
> > > > On Sat, 5 Dec 2026 at 01:07, Kuniyuki Iwashima <kuni…@google.com> wrote:
> > > > >
> > > > > On Fri, 04 Dec 2026 16:34:05 +0000, luca…@gmail.com wrote:
> > > > > > Hi Kuniyuki,
> > > > > >
> > > > > > Is there any update on this series? It turns out it's something we really, really need in systemd as well...
> > > > >
> > > > > Hmmm ... ??
> > > > >
> > > > > I remember Christian and Lennart didn't want the filtering
> > > > > capability with BPF and rather preferred just a socket option
> > > > > for all or nothing.
> > > > >
> > > > > What has been changed then ? Any context ?
> > > >
> > > > I wasn't part of those talks, but what happened is that AI tools
> > > > figured out FUSE exists, and our security issue tracker is keeling
> > > > over :-)
> > > > So we really need to be able to install sender-side filters to stop
> > > > certain types of FDs, like FUSE ones, from being sent in the first
> > > > place...
> > >
> > > What's the preferred API ?
> > >
> > > e.g. the app wants to preserve fd order, etc.
> >
> > Given the typical way these protocols are constructed is that an index
> > of each FD to identify it is passed in some custom format in the
> > message buffer, which means it's unrealistic the filter could do
> > something about it, I think the sensible way would be to preserve the
> > order, and if the Nth FD is dropped, every (eventual) FD past it is
> > dropped as well, and the FD counter is updated to reflect this? The
> > in-band index is typically checked against the received FD count, so
> > this should work out of the box.
> >
> > E.g. if 4 FDs are sent, and the filter drops the 2nd, the 3rd and 4th
> > are dropped too, while the 1st one still goes through, and the message
> > has a FD count of 1.
>
> That makes the API less useful. I would also like to use it to do
> request filtering. Say someone sends me a file with a socket xattr set
> or a pidfd xattr set - both of which can be read locklessly - then I
> want to reject the file descriptors for requests I don't intend to
> handle based on that xattr (and not for security reasons per se). They
> can be in the middle of the array. So we should simply set a -EBADF
> sentinel for the fds for the files that we dropped. Then the order is
> preserved naturally. We should probably also raise a flag so that the
> receiver can see that fds were dropped and said flag shouldn't indicate
> failure.
I didn't know swapping the fd for EBADF was possible, that sounds
indeed better yes