🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #27328

Re: [PATCH v2 bpf-next 0/4] af_unix: Allow BPF LSM to filter SCM_RIGHTS at sendmsg()

#27328
From: Christian Brauner
Date: Sat, 05 Dec 2026 10:13
54 lines
10998 bytes
On Sat, Dec 05, 2026 at 01:42:24AM +0000, Luca Boccassi wrote:
> On Sat, 5 Dec 2026 at 01:29, Kuniyuki Iwashima <kuniyu@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 <kuniyu@google.com> wrote:
> > > >
> > > > On Fri, 04 Dec 2026 16:34:05 +0000, luca.boccassi@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. 
Technical Details
Message-ID: <20261205-hetzen-zeugnis-obsolet-2b351f2b3ecf@brauner>
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377929-linux-kernel-netdev=dewy.ru
References: <CAHC9VhSDYwekbzzZB3LwQG=hVVX0-wfFg0i2n2Y_MuyAtv7OWA@mail.gmail.com> <20261204163412.988198-1-luca.boccassi@gmail.com> <axNi4aU78yaigWx-@google.com> <CAMw=ZnSRLFGrvOQ+sgfebvq9cAg0qAc88P3_RyUJase6Ktqjhw@mail.gmail.com> <axNoQfXHYj0K1nOl@google.com> <CAMw=ZnTZp_MZKfi4mfwA-A0PXWu5rgRtYuzVYRe8p-RfaMKjaA@mail.gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377929-linux-kernel-netdev=dewy.ru
From: brauner@kernel.org (Christian Brauner)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH v2 bpf-next 0/4] af_unix: Allow BPF LSM to filter
 SCM_RIGHTS at sendmsg()
Date: Sat, 5 Dec 2026 11:13:58 +0100
Organization: Usenet Network
Message-ID: <20261205-hetzen-zeugnis-obsolet-2b351f2b3ecf@brauner>
References: <CAHC9VhSDYwekbzzZB3LwQG=hVVX0-wfFg0i2n2Y_MuyAtv7OWA@mail.gmail.com>
 <20261204163412.988198-1-luca.boccassi@gmail.com>
 <axNi4aU78yaigWx-@google.com>
 <CAMw=ZnSRLFGrvOQ+sgfebvq9cAg0qAc88P3_RyUJase6Ktqjhw@mail.gmail.com>
 <axNoQfXHYj0K1nOl@google.com>
 <CAMw=ZnTZp_MZKfi4mfwA-A0PXWu5rgRtYuzVYRe8p-RfaMKjaA@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Injection-Info: usenet.network;
	logging-data="3004858"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:kvORJTOulREPC7VYB82F6VJvvXw= sha256:/WHhzxWgwZmbeAxN0Tx/oO0Eek6bYTQ8/SKjaarPqSA=
	sha1:ZhPmgdihCTca7OIqeNlgEPjLdME= sha256:v2B7Q0bEAxI1dGCxgUBX2Ygmct1zA0XznV7AAVsNOFs=
Content-Disposition: inline
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id E7BC5117DDF; Sat,  5 Dec 2026 13:14:29 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.542
X-Spam-Status: No, score=-3.542 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.142, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id vwgKYr6L5CMl;
	Sat,  5 Dec 2026 13:14:27 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-377929-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 1A370117DDA; Sat,  5 Dec 2026 13:14:17 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 4FC622A0F6; Sat,  5 Dec 2026 10:14:13 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796465653;
	b=WVEub9emWXOnPf27HJBVyaxjd+B1Gnpktzl/SG3cJZLorYJYdFIn+13TMDZmwZO1jQCh
	 MlwlPAnBKmBiDM52qeGkoDNI/SLZzpqn3C8CJGWtxmgfzDJ1f/OOq0rfzfE169qyMMpjq
	 mMONlCpK1mAjXKz95euzDBfPPfbj3BfxQN54+FocuM5DlabXwnKTvfb/Xf1o25FhnGZpy
	 V4iYl6MqrSdsTgpzRyXnepnIG5xg5Tcu0Shbcwg6H1MvHx/6E6nISZq21ofiaH0xRnrJa
	 yqAsqsjzB0t1iSJa1QMUTYkbo5oPa5aTBLAA1gku/JP+Ch83K+FcfPMyyV7fDms5SSQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796465653;
	h=X-Original-To:Received:Received:DKIM-Signature:Date:From:To:Cc:
	 Subject:Message-ID:References:X-Mailing-List:List-Id:List-Post:
	 List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
	 MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=/cR+Bc8au/Mx2/qjNhZDTBvi/UTyPG5qfE7u8Dk5auM=;
	b=xwe1Ukxrsr3UhUcc6Aen6HNUv21imEnq7PqqvWs31bjq6kxVl0eRWkSwtdhAUBbdlJKw
	 kqF6CVR2OAA2mhfM8IuH5vkVXdNZa+UBnjNNcr3sMttUFACOJrukapYZMj0GPdj2Bb4OM
	 FL87iEk8x+3xT2d8Q6Ziw7SUFxQ2VTMMe+7r2x2HMEqOIkpsQMWDYuO6JjtqxG7g6qmEP
	 N/4Wc6CvO8mInQf7Ty1kKP80/O+t98tcvgfXv7Xviu5EYuBjVQDxE3iXddd8luednAR4B
	 bmwn0IFxob9W777r1+FqpKDbtNOWHcuoHmkREbWIMBODufAmmaefRImuo1lpjRhXSrQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bxtfW6wo;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 03A43606A332;
	Sat,  5 Dec 2026 10:14:13 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bxtfW6wo
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796465647;
	b=n8sd2vMC6ih8SD2dGREOBczPzEB2vuwBGf47plwTAYuYcIl2WGfSc+hpV3w1wBwZt+TU
	 1MRk4ZCGR3+XTjpnH9rbUF235uA3ZXZdRPPkKb2QWgMuKoQYlNpcB+52wmICYO7zr4ib+
	 9dHVQoPnTu6f+XC3zVs1Glz/8sU7F9Mbo/mLkJq/piuxZWWUmsZy6ghLvBXH/eF5rUWVY
	 FLSYm36bZR7SLdO8HQHcDeBo2dJQLpF6wW9XsQ4lv0EjwLIdDHcisVbOwNXel/4inodNA
	 Y+fhnuSlQgxrKVstxlGY30hcba4pLDCC3TRNSa8/P+kQt6CdLKKLufVmAaritUbLP9Q==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796465647;
	h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID:
	 References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=/cR+Bc8au/Mx2/qjNhZDTBvi/UTyPG5qfE7u8Dk5auM=;
	b=w0nQO2toKunMMaAD1XPrAdUadTcIwao0A7br4eWWHc+ehWcrSGV0nwM7sIDByoc1DCLw
	 HUXCc+zcFPgFGjQz5RyWiHTxqVgbgyW38BEAPNDe3vGxP/PX/5KEQrf41SXycqdgYU8HQ
	 IJ7WZWDuUMB9CNi8hp75WDd0BwqETY6B7Lkal4+KNHy6WLBp4tRueKHu/bxf38z5JlB9B
	 QOEGrFNrqwxGhFkauGoj49H9dhamVs1Yg4oNj6HDOdd7qO+aJHImNpJ5TF5aJslESQjp4
	 2buepjf/ZGPdpaJ7Fex9b32jhLY7Djek5sQF3wBkTFTvdQuT+HBkkU9ckOBQ2VlPtDg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bxtfW6wo;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1F3CA606A330;
	Sat,  5 Dec 2026 10:14:06 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id A18451F0092B;
	Sat,  5 Dec 2026 10:14:00 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796465646;
	bh=/cR+Bc8au/Mx2/qjNhZDTBvi/UTyPG5qfE7u8Dk5auM=;
	h=Date:From:To:Cc:Subject:References:In-Reply-To;
	b=bxtfW6wohr1Z9B1BYv//XwFMXla2Bm/JVObX63lmc68axENq/nnehnFY3iELgt/6I
	 4jlItMvMeRYGzeg1u7oF/5dxZcij8S5B0UyYG5wb8TIoFnaYkWnjCnDlKMXWKzkxZ4
	 3OC24kAP1ZdI0Rt5uKASrvKTUqW8ctwjvgiDwT3RtSmKVV37qfWdhDbQ2rQKcoz5pr
	 WCBoQeYK0SiU/mSjPKEE998jViCh+hKYkrdaXOOR8OjZfCpkBMZHwECf7DXBlk3WVN
	 9HRPY7a3GCxA/wptCB9Lk79ZP8zyu/PK9ECkFFGfkWxhhFa1S3cXB+Np9vGq2H8lK5
	 uWmgnsg3ROhdA==
X-Cc: Kuniyuki Iwashima <kuniyu@google.com>, paul@paul-moore.com, 
	andrii@kernel.org, ast@kernel.org, bpf@vger.kernel.org, casey@schaufler-ca.com, 
	daniel@iogearbox.net, eddyz87@gmail.com, gnoack@google.com, haoluo@google.com, 
	jmorris@namei.org, john.fastabend@gmail.com, jolsa@kernel.org, kpsingh@kernel.org, 
	kuni1840@gmail.com, linux-security-module@vger.kernel.org, martin.lau@linux.dev, 
	memxor@gmail.com, mic@digikod.net, netdev@vger.kernel.org, omosnace@redhat.com, 
	sdf@fomichev.me, selinux@vger.kernel.org, serge@hallyn.com, song@kernel.org, 
	stephen.smalley.work@gmail.com, yonghong.song@linux.dev, 
	Lennart Poettering <lennart@poettering.net>
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <CAMw=ZnTZp_MZKfi4mfwA-A0PXWu5rgRtYuzVYRe8p-RfaMKjaA@mail.gmail.com>