From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm2-f10.google.com (mail-wm2-f10.google.com [74.125.225.138]) (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 C3DD141CB5E for ; Mon, 20 Jul 2026 21:24:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.225.138 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784582695; cv=none; b=qtNoRgoZKFU5WciVFVABcbdUcYlYeuKa1D3PsAm9KqlJHAZ8C8J2HftqJXrsVVpcsvRjI72C7+96gcxIHR7Lz8G/zcxqxLKY7i0JZbicmJT0tbxfacVty3nn17qI1duDOvOmYs6IJQufZvLBYnO8+ggMevITtwLuOvrJsQVRSdM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784582695; c=relaxed/simple; bh=RcxGzEEwefX7zAbWTLQPNtYc6E9SwfZuoICNfQ9Im5U=; h=Mime-Version:Content-Type:Date:Message-Id:To:Cc:Subject:From: References:In-Reply-To; b=nNEGmgtIuhMBXH+QxD/E8h+3Zdpn3TFWl9b1KOk3nQoPSiyJJCH1e1sg1vd51TDLqOXZ84PoOdzWWrqq/yXK/K2G4Ss+EbeTvH50WfDErcbSjDDBl/YwWw9lD8hOKV0BpOCIh27f50Ff4TVy2sVZzaJwOE7ZD0dVJJM63zN6fSo= 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.138 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-f10.google.com with SMTP id 5b1f17b1804b1-4954b049503so6748735e9.0 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=TyI8QW5pBARt1vIBuS6cE+im9+WTnkGlNCdHJLM+VzrMawrBs9B17Eig72VS4GspGH 60L8gsIXeeUxPbhmm5KbQRQ3FF+jT3uS/JrH3JGCgmUje09EqvSquDdHDUlrpVZ6kQ2F YBD+he65+C2WfHv2SkFVt3VKHWchq/qrho2m9xmqIzBpjXk7onhKNql6PJsaaijvM2Ow v/Ee0gydALfluKbnKbOayi5jW0WrCuInmK7tzatKTtS3a7diS3xm4eUkLUu3NkJaaFuY 2gqlJVmkUAaDIiwn3zin+3M4lrbol8FFa7bPBdhf00zL6AkQJbEoA7p9VO8+rNHEYB9a 71rA== X-Forwarded-Encrypted: i=1; AHgh+Rpp6OA2e0ijFqI5RdIZpMhGONg4kbHLonTEbzMhwiENf0DNyiLqWqBTCGnNZ7fmprqucl0=@vger.kernel.org X-Gm-Message-State: AOJu0YwnZarK2vE51JlSq2zNtCHQwMQSaH9895RGfPmhrR6/VgR1KZA5 z6HQKlzR0nkdkul3M3YzvKGNutmAPzRl1e1T82dekb++yKe/r0WqEbsZ X-Gm-Gg: AfdE7cncw0wucPM9p39ZVGzuy8VbbKorGfX51+VMJJ2CnHTZiYTAKi+AYW8VS1J22Sg k2T/1gN7EY8N/QBCL+naJFDk2hx/lB1iphdQQFNzGl1uwWYiEBEe9rUdDZCtCk/RPHpHhuwqKFi WIu9SAdutC8Dhj76niXWMEf8LYdsYHMSlfdvzMcXKmGNOtRTzSRBfw1bTtbXQE2VhhTdUsxBzI6 HMuu0uAghMGwZ9IsVUizb95kyZ0+hb6AWnaWHlgXzkFlZgWEQez4htjz3xDkk+Qa01ELrPCyHCS QoOboTrwl94hcec4aMDkgy3YSgKvtlb6Pbu527QGFl+UEq0u+DCVok4qC0VCXBT1x3UQYJOqy+x n6bHgfJTEEblmez4LIUth3wgxcajFvjYtaGfHLoIiSkNrjCiPzd00zhOYGCV5k1qfDZUuO9OKec SiBypr2g7u6nhaE2LQn7beGkCf0oWGLvLskkEVBg0GSEtoFGy6rrmYCngjE0tlRGEZn8/3yFh/7 COJHWRPMdtQ4kkvPPCdneTBv1B+tndS6aP5Nxfwspmi 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: bpf@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.