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=1796443751; b=uLUpaLhIrPGTrlNNkSvliISbK+da98v5/1OlCjUzEnTm6XA1LkIIc46YYwaRAZzDumtD LxCnSkI/2n07hLbzQ79J8vT44/hrCbW+di6JFeU/SFYHayQr+8K3P5vZQqar6NYLuix4T oZsO90glBDocvYrYAPrDwd3OVlHVAPLmHN4CEvKg7E8pBTJQO6P/o+41IlQBOwZuAI9kI c2GGb6HApdj2S1kPdc5Mmp4mImTktcIURoLjSJxWIQZiK6WzBzQXS8Ip6Ns5LtSMQEGUR BizY3fqrJWTcDHMD/Qcqob6uFDT22TcAMs1d0XaftUH4U60HXva2RDItY/A1CDniriw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796443751; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=Xt6GBaOrOwLK1Gbkzjq3qyLjRGYTk34lFZoDxiP8iWs=; b=VjVUQ87uvenrExh2rsTmETU0hKs71AUIL3sRURO/ABKPhvxUka3yTTtjhDvhniRLr3Wh yZs6H7j5IOPA2F1m//y2em3A1jVlpzvAiLvOeYzB0fxZ4tR2NENuqI58e4ATr+obAFoRp /a0gfujSryX9ak7Z/UiEN7uT0rbnxeHJpmnhQK/Xy0WsKA7un6POyBH545WEzX/nkUAHo Ovgqi8vZQXoJRtJ/OQ9nPn+Zh3cSDkKMwbP/bPzQEhH0K0+TsWYZDK8Kl3XM3jnf5cQFs 9RzNCerIx/58EjqKoNYJg7yVsMl8hm2k8uO/8414YmmlooMrHJwp729vQuU6TIGz17g== 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=CcluRvUh; 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 ESMTPS id 685E1606A322; Sat, 5 Dec 2026 04:09:11 +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=CcluRvUh Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7262A1F0092B; Sat, 5 Dec 2026 04:09:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796443751; bh=Xt6GBaOrOwLK1Gbkzjq3qyLjRGYTk34lFZoDxiP8iWs=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=CcluRvUhMvIqICA7Yk4R0raMptmj38j65Jsd+nEQXwJZqRxjgrRJEcNzREJTweO89 liI/ylvo0uY4DjxdU3tKWLd/exX5Mxfi0WxBs8Q+RH5FFRg44qLZI+mNFf8v08AGeS mcfmYvQlyccC3vDcAts/ZYwS3HWQIp/XjAIlm+UdDKAdebO1FVJliRhfHr6d5nSjk3 tUGwy+nYRgNeuvlaQJlmpM2ImuDufN6xGIIpuZMbH6Ca5yHebatVC53XQHxv2PryNy CVtKdd5gQiKx12OYsyX2yIIbVcJqLk6fHQFfbY62O4yS4VCfu/FUKpZsFt3QsTVsOH u7PQi6Wp4Mu4g== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [RFC PATCH v10 23/28] landlock: Enforce namespace use restrictions on run Reply-To: sashiko-reviews@lists.linux.dev To: "Jarkko Sakkinen" Cc: bpf@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?b?R8O8bnRoZXIgTm9hY2s=?= , "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?b?TWlja2HDq2wgU2FsYcO8bg==?= , "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" In-Reply-To: <20261205032633.1702772-24-jarkko@kernel.org> References: <20261205032633.1702772-1-jarkko@kernel.org> <20261205032633.1702772-24-jarkko@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 04:09:07 +0000 X-Mailing-List: linux-security-module@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [High] landlock: missing namespace use enforcement for FSCONFIG_SET_RUN - [Low] landlock: check_ns_type() kernel-doc cites run(2) instead of runfd(2) -- commit 6acef090a51d95ae4adcc6726feab0cc0e025f7a Author: Jarkko Sakkinen landlock: Enforce namespace use restrictions on run This commit wires Landlock's namespace hooks into runfd_share and runfd_clone so LANDLOCK_PERMISSION_NAMESPACE_USE mediates sharing a namespace into a run and entering run namespaces on clone3(CLONE_INTO_RUN). > diff --git a/security/landlock/ns.c b/security/landlock/ns.c > index 3d443599b16f4..5851195e31f05 100644 > --- a/security/landlock/ns.c > +++ b/security/landlock/ns.c [ ... ] > @@ -93,10 +104,10 @@ static const struct access_masks ns_permission =3D { > * @request_type: Namespace operation reported on denial. > * > * Shared check for namespace_init (creation via clone(2), unshare(2), > - * open_tree(2), or fsmount(2)) and namespace_install (use via setns(2))= : denies > - * when the namespace type is not in the domain's allowed set. At alloc= ation > - * time @ns->ns_id is already set even though the namespace is not reach= able > - * from user space yet. > + * open_tree(2), fsmount(2), or run(2)), namespace_install (use via > + * setns(2)), and runfd_share / runfd_clone: denies when the namespace > + * type is not in the domain's allowed set. At allocation time @ns->ns_= id is > + * already set even though the namespace is not reachable from user spac= e yet. [Severity: Low] The syscall is defined as runfd(2) in kernel/runfd.c, not run(2). [ ... ] > static struct security_hook_list landlock_hooks[] __ro_after_init =3D { > LSM_HOOK_INIT(namespace_init, hook_namespace_init), > LSM_HOOK_INIT(namespace_install, hook_namespace_install), > +#ifdef CONFIG_RUNFD > + LSM_HOOK_INIT(runfd_share, hook_runfd_share), > + LSM_HOOK_INIT(runfd_clone, hook_runfd_clone), > +#endif > }; [Severity: High] Does wiring only runfd_share and runfd_clone leave FSCONFIG_SET_RUN unmediated for LANDLOCK_PERMISSION_NAMESPACE_USE? In fs/fsopen.c, fsconfig_set_run() checks ns_capable(user_ns, CAP_SYS_ADMIN= ), rebinds fc->user_ns and fc->net_ns to the run's namespaces, and invokes fc->ops->set_run() (e.g., mqueue_set_run() or proc_set_run()) without calli= ng any LSM hook mediated by Landlock. A sandboxed task holding a pre-opened run fd with CAP_SYS_ADMIN in run->user_ns can bind an fs_context via FSCONFIG_SET_RUN and instantiate superblocks in the run's foreign namespaces. When CLONE_NEWNS is allowed, fsmount() only checks CLONE_NEWNS and exposes those denied namespaces. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261205032633.1702= 772-1-jarkko@kernel.org?part=3D23