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 BDE183CE4A3 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-49553b57612so4830635e9.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=kwZaxMYvXBX8qJSEic1amroiwBb9TGhAQxSoJMwvHgu/qXPjK93QmIA7A5HIrl7Q0E y01als8XVVP4frWKjA7nxgj5/qbpojB/SHPnwrWC1l92aLfSLxs/gouqZzpZMjxOM3T9 nET4cCXXCdYMnWco0EmFExB8IuEbegu4/htX/8fcn/c3ITM6AN7ayf/Qj/rizFFNMWmT 7+hngPpp/sd1g5KzN0JoJtU3EOkPA1vySYKRjISNIo5bW6isGPtP/cD21xEjsqompu6y c1qeqIVaNCM3ol+KBnCTzpiYEmNV31odaMbXKflUxJLSj0i7Yck3sPV1JuJqleaf1XCL uitA== X-Forwarded-Encrypted: i=1; AHgh+RrZyXKCurC3nXqizWtR2TF/E4CXBqC+Fa1anRIVJ99YPhSbPterCN8SayulJ32sPQP8Oa9bfAizFMZS/E4e@vger.kernel.org X-Gm-Message-State: AOJu0Ywjl+XozgA8VuUU9CDEccM2aNkqK5JFOSWgq/L9d5fg6RBlEkPz altnG2dmQkiBsj0lXpBiy/Of9GK6Htnx+rB72uuiocTJmMQvCn1XD5KH X-Gm-Gg: AfdE7cna8SUrrckGeissZjfXoG2rlsmHa7uvW6r2LGk3zClhT8y38ciRRw4IFmpeIxR b7xe+kzJNxBAY7k+US1sVC++l2eJaP2vbWSnOGW/uvpCXM0OpyOcgLYHR/eOGDrNb6FpX7+jVKM RvPukX3xym7CteKZGC9qBp0ErqgNkzjHQu9IHjacDJYmHMgasqWOAkRtr/6HTfbhNmSTahrOWqW VG3jDPPkcHghSgRqIYnSfswoU4dN+iTUf5lbPWHZjBkbpBQJ3fKVgIYtyN7Wzp40cjb/hqXjkts WFIe2zGwN1vGdI6z6jSPmzaEQDp3fN7k+U7nxay/1MQGbNB1nKTgIypUcKj2KdOEMdltv84WSjh sBJbJx9HdfJDveXoREm8iTz3t/G8iu0NmOybKCbWvhxDdHazcQ9J5fagLx8ATwvD2uepQzygHJH AYJFRV7VkuZGUkjkT40PMDQoYMvHJS/nY3Fg217SbC1Lb/BmLzm6Gj/5F94JzepD2nUYeikTVhE S/sHTq/chrvYCgM9FKuVnRG9nBCvbplvluyPScYZWN8 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-fsdevel@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.