From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm2-f9.google.com (mail-wm2-f9.google.com [74.125.225.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BDB553A4F3D for ; Mon, 20 Jul 2026 21:24:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.225.137 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784582694; cv=none; b=bniMT1IHtwQeohBO6TFoR8K74xWF3NYG7Gx0+TZbVrAIsKnOyZLam47DtdEaR1oQT/P+XdPf0PdS5RE/y7BTF1EKOHMMxMXyTQGKb9n05OLmkZW0CMAfqtw7aazQ7a+n2M3dGukhW9yA9z8uxrWtvl9+0MWD+ACgEpXaCpyxE0M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784582694; c=relaxed/simple; bh=RcxGzEEwefX7zAbWTLQPNtYc6E9SwfZuoICNfQ9Im5U=; h=Mime-Version:Content-Type:Date:Message-Id:To:Cc:Subject:From: References:In-Reply-To; b=QaoLbQC/BoSUDwH+KscdyaoR3b69PZq/XyYoB6TypVvEiDBI/pdSQmb4JAEYMUYgfxfug+TF32+UmyLhjuKjA6/+yfk/ik7Gt+CN1kPgqlm9bd3jV/9ggcXZpxWk83jHCjf6VdXGJXcIcgfAiVEGA8mtkm/qhZ+FvtJnL8ILO3Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=aLAdZdR5; arc=none smtp.client-ip=74.125.225.137 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aLAdZdR5" Received: by mail-wm2-f9.google.com with SMTP id 5b1f17b1804b1-49553b57612so4830615e9.1 for ; Mon, 20 Jul 2026 14:24:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784582691; x=1785187491; darn=vger.kernel.org; h=in-reply-to:references:from:subject:cc:to:message-id:date :content-type:content-transfer-encoding:mime-version:from:to:cc :subject:date:message-id:reply-to:content-type; bh=GodhWzpy/c4vsdA8Jyp/tHYkO7IhbQZ6imvsrnVIekE=; b=aLAdZdR5xPOkHVS3ZZO7tRXs2KoCcxRTyzJw7bqbbmG2FCksMr4SWNeHNOCraKJgJ2 JQItI9AznZ2nyXmDvj771w2dmcTtCkVKpNC7g3rr/twj8xAz6lYCyxD+AbLEVcyPngMh NUbQ3jVl4SrRUTkN2cxLs0tldzjYZy1dkaaGY8gEBE17ikCIK7J22uz56vw6HsfpyPMp GsWq1UnfN9MEtxJn1JhkskV3hUUNSsY3KYztwelvpUgAXvRF9lbI6Kku/n8zVWvatNbH Q+WUZDZFmuqr+b1YEHcCG2M0QbqaLP9/UB8fTd2avdFTO6a0Xc9gdFnE21JfbvJrZQYb H23w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784582691; x=1785187491; h=in-reply-to:references:from:subject:cc:to:message-id:date :content-type:content-transfer-encoding:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=GodhWzpy/c4vsdA8Jyp/tHYkO7IhbQZ6imvsrnVIekE=; b=o5Y/DLX5TB6MPlM7X6HDUbTEkCgdUINwS9sWZwe+um94S1EV1QHbL/Ky9IWbYwozaC pCkXlU3vCDTj/aFjuzQrC3HMPizhHn27Hu+vhzUI6iqMshPdNnvE8gw/GoHYtDgfnjrg rRx5KUEaO8ZoK9cy8kSzhtxo6acucRrlIkkWS4rc6cimUcLnZgXuThNaVuEskMmEmwlm 4Bn2Mz02H3JmRo3SEda/zuJwKvrp+26Jz1vwxGIeBL5FqV4Adqy+KUXzXPYxK5blJumD d2vh3GzYJMSzB46AMZ4kJzNUG1Csh4ms2YJMURePj9bLgvE0ggX1CeaIXJ2lNkESkTg4 eukw== X-Forwarded-Encrypted: i=1; AHgh+Rpp/OG34kqKYnLDfnE2DBljoT16lmZhpem3hme8G2Qc6u4UrU4y6Qtm3DQ2nhhCKsaUVT0WVht/A+sVBGBRhdo=@vger.kernel.org X-Gm-Message-State: AOJu0Yz7TmGY+JLguvD/X6jsx2EmXRzEnsfo2ln4XiNelgtvUaQwWdev HFLOncRameQfkLyLFEKFhCyCRjlikPff2hxoPbON7AguU7zXVrhMp+L3 X-Gm-Gg: AfdE7cnmpX4aozokSAvHIuQpZxoVLqKqpv9f8hl/8AdgCCXncoiJsXEzO3k4mSrYAuW nV2ccCf8rpYW6MYWhue/YbZicn0QKV4ctGoXVosn55RBbifqyTnWv2i2o6JWQ+aWhgx5uwngxgW Tmdzt1ozI7w+/t+6SCbgMqLuSmI+C4U8hRrk5Aph2ntFRwlKqH+N7l6TskQ9MZvUpXfW5tDbZT2 Gf1ZVo1w5pOArjBkK7FDJ5CQDkT8jLWRuGT+uEu+clI2CPExtF/nU4dj5v25ZZ23n+aLVfMHWeu K+NQ5fQaFJWp6C2q02bsgwSu5nJgxuCGeRYwY87JCeuyIsy1R1oPyJAw9lZ+BwiMNocZyjXuXCG t0kT05BY9yJ2x0GwmON51M5Y7eepeolFRJi8jdQuur43F5lTCzLgFEkoBrynOgjO/JBnMUvS58A 1C8VFr7ttCaXHWl9XOSw9P+C7imtbZjeOQaytRYxOsfly5Bc06n8BfXWSiE0tt0ngAk7hbjO5is CmwOobE2bGfxPOSLkiIyHWiaZ062lfD+xekho1Ydkn5 X-Received: by 2002:a05:600c:4fce:b0:493:fa66:4861 with SMTP id 5b1f17b1804b1-4954a404bc2mr195886525e9.25.1784582690803; Mon, 20 Jul 2026 14:24:50 -0700 (PDT) Received: from localhost (nat-icclus-192-26-29-3.epfl.ch. [192.26.29.3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-495653bffefsm17137255e9.9.2026.07.20.14.24.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jul 2026 14:24:50 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-integrity@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Mon, 20 Jul 2026 23:24:49 +0200 Message-Id: To: "Paul Moore" , "David Windsor" , "Kumar Kartikeya Dwivedi" Cc: "Alexei Starovoitov" , "Daniel Borkmann" , "Andrii Nakryiko" , "Martin KaFai Lau" , "Eduard Zingerman" , "Song Liu" , "Yonghong Song" , "John Fastabend" , "KP Singh" , "Jiri Olsa" , "Emil Tsalapatis" , "Matt Bobrowski" , "James Morris" , "Serge E . Hallyn" , "Casey Schaufler" , "Stephen Smalley" , "Ondrej Mosnacek" , "Mimi Zohar" , "Roberto Sassu" , "Dmitry Kasatkin" , "Eric Snowberg" , "Alexander Viro" , "Christian Brauner" , "Jan Kara" , "Shuah Khan" , , , , , , , Subject: Re: [PATCH v5 2/3] bpf: add bpf_init_inode_xattr kfunc for atomic inode labeling From: "Kumar Kartikeya Dwivedi" X-Mailer: aerc 0.21.0 References: <20260708000956.46138-3-dwindsor@gmail.com> In-Reply-To: On Mon Jul 20, 2026 at 10:15 PM CEST, Paul Moore wrote: > On Mon, Jul 20, 2026 at 2:27=E2=80=AFPM Kumar Kartikeya Dwivedi > wrote: >> On Mon Jul 20, 2026 at 8:12 PM CEST, David Windsor wrote: >> > On Thu, Jul 16, 2026 at 5:55=E2=80=AFPM Paul Moore wrote: >> >> >> >> >> >> I'm sorry David, now that I'm seeing this function again, especially >> >> with the LSM specific bits extracted into a LSM function, this absolu= tely >> >> belongs somewhere under security/. It's only callable from within a >> >> BPF LSM callback and all it does outside of some BPF pointer boilerpl= ate >> >> is call right back into a LSM helper function. >> >> >> >> If the BPF maintainers aren't willing to accept that, then we will al= l >> >> need to find another way. >> > >> > Where this code lands doesn't matter to me, so I'll stay out of the >> > decision of where it lives. > > Yes, you're caught up in some territorial wrangling that goes a fair > bit beyond what you're looking to accomplish. My apologies for my > half of that, it is an unfortunate part of upstream kernel > development. > >> > If this kfunc goes to security/, would we also want to move eg >> > bpf_set_dentry_xattr similarly? >> > >> > I'll roll v6 of this series meanwhile and we'll see what the BPF >> > maintainers say. > > Thanks. Fortunately, it should be easy enough to move the kfunc > around, that's likely one of the smaller changes needed in v6. > >> I don't think there was any preference expressed from the BPF side. > > Look at the second patch in the v4 patchset, you'll see a preference. > >> Logically, >> one cannot be faulted for adding a kfunc to set the xattr for inode in t= he same >> file where similar kfuncs to set xattr on other FS objects / entities ex= ist. > > First off, I can't say that the existing BPF kfuncs intended for use > within a BPF LSM program are in a good location. Unlike every other > LSM which locates its code under security, the BPF LSM devs have > chosen to locate their associated code all over the place. Some of > that happened before I was responsible for the LSM framework, and some > of that which has happened afterwards has likely intentionally avoided > traditional LSM review. Unfortunately, this has muddied things with > respect to what is possible generally in BPF versus what is possible > only when the BPF LSM is enabled; we just recently saw where this was > arguably the root cause of an exploitable vulnerability. > >> The question about bpf_set_dentry_xattr is thus valid. > > It's a very valid question. It is my opinion that kfuncs which are > only intended to be called from within BPF LSMs should be located > under security/, just like every other LSM. If there is a kfunc that > is generally useful from other contexts, that is a different story, > but in the bpf_set_dentry_xattr() case, it is explicitly only useful > for setting 'security.bpf.*' xattrs. I don't think we should do that in v6 though. What you're describing affect= s all other xattr kfuncs. That's a broader discussion we should have separately w= hen folks are back from vacation, and more importantly involve FS folks where t= he code currently lives. As you say yourself, the lines are blurry, xattrs are= as much a filesystem concept. So I wouldn't burden David with it right now. David, just respin addressing= all other comments and the CI issue.