From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796094736; b=WYwN8tO1NHt/DAqA1SICQv8RXbQOZ6qhmc6IoJhS7dI2LuX0TAIS9sZV8smTsWMCgL7C xY1Dg0MI4dGzIzKg8N/aY0WqMiYIh2u5AiK7X6mHTwbAoLpUnT7aPq1/UQYrGyzqTNKwI FNfQa71tz2ht6huY6igwOAurierfI+5qyIBlqD+9+pMXGXCDzp+eCKhit7xQQXM8YwhKM g7QB7oeG/BqI0KlebJCE9e1M4KeRLqrFj/e7RTyKtnKBmjs9HE4FsZRfoq5N8Y3Zqt3YF n2YrFlwMaxXiOITn0ywKFwxiV/BBBwnr9v/BKiA8iNryaI6zTIi4S505cmX8sjU/IwA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796094736; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=YQ/PReeHMeYqyXkCSPTmMJeEW6VmwZ3K9bLm0uzN+dM=; b=DjVrMql5/2xyQGQDliWXcZOAeRy9icV3s10GmGLWLAZEKoF1Q/aRlKlyv22V5ayEjYKZ UbUX2YvEUaGN3qfIQ4U1VW+h7bT3sFxD6h96gpQMtbFRSMTrCiJD8U43AahqNKgOuhiP8 8BHDc0FMzJFG8Q9KvOT3OnyTr1xPsa0J0ktO1CUu+aDO0loxrqqXFwrB9Ib+TFX0G/lLd xMZDg2cAujmDZqE9DjKD/OEV9mmebTsIzObo2N3gOHDWGOyOp/SpCOeXBe2S7qv2qZYhM yLw0FNKGSuiS8Xg4665knK/59PXAXTokD0Mor8M2qsmYRqB13lcloBacIQ3vA/HfOJQ== 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=VfGPjQIM; arc=none smtp.remote-ip=100.103.45.18 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 UTF8SMTPS id 45641606A680; Tue, 1 Dec 2026 03:12:16 +0000 (UTC) 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=VfGPjQIM Received: by smtp.kernel.org (Postfix) with UTF8SMTPSA id 337701F0089C; Tue, 1 Dec 2026 03:12:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796094735; bh=YQ/PReeHMeYqyXkCSPTmMJeEW6VmwZ3K9bLm0uzN+dM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=VfGPjQIMHQiGVI6keCkRajfIKtmz8VGrOWPDq5wqQgRuEfZ02xAawMaWOoQDHM+De hFGiLXWdcniJBnc21V8mnlnH/Kt/Fxmq4ne/Nlxzc54feqgAxSC4MOnbvVsutFZz1Y XfEFnsxht63xVPsL7OqvBvMPiKR6TQEKn/YUgN8GfnApxM7M+CEcfdqBZFvP3ldMWy eFTjzW3XBy3h5uQcG0+m5FRs9CFf04qz7rmAk2Zty9cLovbnGKKCvXLs5mXfnIix5F SuqJSDHfJDfYT62qIMENG0w87ZxWJpBIrzNanCQAkWnahNZEJzNyiRPjKEVUBeaSzm YsCdRMjiKqsng== From: Jarkko Sakkinen To: fsdevel@vger.kernel.org Cc: Jarkko Sakkinen , bpf@vger.kernel.org, containers@lists.linux.dev, linux-api@vger.kernel.org, linux-arch@vger.kernel.org, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, linux-security-module@vger.kernel.org, Aleksa Sarai , Alexander Mikhalitsyn , Alexander Viro , Alexei Starovoitov , Andrew Morton , Andrii Nakryiko , Andy Lutomirski , Arnd Bergmann , Baolin Wang , Ben Segall , Christian Brauner , Daniel Borkmann , David Hildenbrand , David Howells , David Woodhouse , Davidlohr Bueso , Dietmar Eggemann , Eduard Zingerman , Emil Tsalapatis , Eric Biggers , Georgia Garcia , Giuseppe Scrivano , =?UTF-8?q?G=C3=BCnther=20Noack?= , Hugh Dickins , Ihor Solodrai , Ingo Molnar , James Morris , Jan Kara , Jason Gunthorpe , Jeff Layton , Jiri Olsa , John Johansen , Jonathan Corbet , Josef Bacik , Juri Lelli , Kees Cook , K Prateek Nayak , KP Singh , Kumar Kartikeya Dwivedi , Lennart Poettering , "Liam R. Howlett" , Manfred Spraul , Martin KaFai Lau , Matt Bobrowski , Mel Gorman , Michal Hocko , =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= , Mike Rapoport , Neal Gompa , Oleg Nesterov , Paul Moore , Pavel Tikhomirov , Peter Zijlstra , Randy Dunlap , "Serge E. Hallyn" , Serge Hallyn , Shuah Khan , Song Liu , Stephen Smalley , Steven Rostedt , Valentin Schneider , Vincent Guittot , Yonghong Song , Zygmunt Krynicki Subject: [RFC PATCH v9 25/29] bpf: Register nsexec LSM hooks Date: Tue, 1 Dec 2026 05:09:57 +0200 Message-ID: <20261201031002.593830-26-jarkko@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261201031002.593830-1-jarkko@kernel.org> References: <20261201031002.593830-1-jarkko@kernel.org> X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit BPF LSM programs need sleepable and untrusted hook classifications for the nsexec LSM hooks in order to attach policies to nsexec allocation, namespace sharing, cloning, signaling, and release. Register bpf_lsm_nsexec_alloc, bpf_lsm_nsexec_share, bpf_lsm_nsexec_clone, and bpf_lsm_nsexec_kill in sleepable_lsm_hooks, and bpf_lsm_nsexec_alloc and bpf_lsm_nsexec_free in untrusted_lsm_hooks under CONFIG_NSEXEC. Signed-off-by: Jarkko Sakkinen --- kernel/bpf/bpf_lsm.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/kernel/bpf/bpf_lsm.c b/kernel/bpf/bpf_lsm.c index ae23511fd811..41a62fb08656 100644 --- a/kernel/bpf/bpf_lsm.c +++ b/kernel/bpf/bpf_lsm.c @@ -16,6 +16,7 @@ #include #include #include +#include /* For every LSM hook that allows attachment of BPF programs, declare a nop * function where a BPF program can be attached. Notably, we qualify each with @@ -404,6 +405,12 @@ BTF_ID(func, bpf_lsm_task_setscheduler) BTF_ID(func, bpf_lsm_userns_create) BTF_ID(func, bpf_lsm_bdev_alloc_security) BTF_ID(func, bpf_lsm_bdev_setintegrity) +#ifdef CONFIG_NSEXEC +BTF_ID(func, bpf_lsm_nsexec_alloc) +BTF_ID(func, bpf_lsm_nsexec_share) +BTF_ID(func, bpf_lsm_nsexec_clone) +BTF_ID(func, bpf_lsm_nsexec_kill) +#endif /* CONFIG_NSEXEC */ BTF_SET_END(sleepable_lsm_hooks) BTF_SET_START(untrusted_lsm_hooks) @@ -422,6 +429,10 @@ BTF_ID(func, bpf_lsm_sk_free_security) BTF_ID(func, bpf_lsm_task_free) BTF_ID(func, bpf_lsm_bdev_alloc_security) BTF_ID(func, bpf_lsm_bdev_free_security) +#ifdef CONFIG_NSEXEC +BTF_ID(func, bpf_lsm_nsexec_alloc) +BTF_ID(func, bpf_lsm_nsexec_free) +#endif /* CONFIG_NSEXEC */ BTF_SET_END(untrusted_lsm_hooks) bool bpf_lsm_is_sleepable_hook(u32 btf_id) -- 2.47.3