From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 07E6E606A322 for ; Sat, 5 Dec 2026 04:09: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=CcluRvUh Received: by kanga.kvack.org (Postfix) id 54D3F6B05B4; Fri, 4 Dec 2026 23:09:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4FC856B05BB; Fri, 4 Dec 2026 23:09:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 39F2E6B05BD; Fri, 4 Dec 2026 23:09:14 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id F33356B05B4 for ; Fri, 4 Dec 2026 23:09:13 -0500 (EST) Received: from smtpin07.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 5EB88C02A4 for ; Sat, 5 Dec 2026 04:09:13 +0000 (UTC) X-FDA: 85508599386.07.B9187FE Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by imf11.hostedemail.com (Postfix) with ESMTP id C39BE4000A for ; Sat, 5 Dec 2026 04:09:11 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b=CcluRvUh; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf11.hostedemail.com: domain of sashiko-bot@kernel.org designates 172.105.4.254 as permitted sender) smtp.mailfrom=sashiko-bot@kernel.org ARC-Seal: i=1; a=rsa-sha256; d=hostedemail.com; s=arc-20220608; cv=none; t=1796443751; b=xccbcETH0JJ72CPYMjC0hUJ5FIOymx7qGCL4Gu5SjPneH9iUVF9yN9tG25AGcKPXVXG6oe DsKfGf6+SblLnFD/1/t7jCeKJ4+yjUF17tzZP4XHyrESaB/m3k4g892Me9nbxEnF59SZVg DgM9BDJZO9+r+4iMhwtdZ7xwRICR7Zw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1796443751; h=from:from:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Xt6GBaOrOwLK1Gbkzjq3qyLjRGYTk34lFZoDxiP8iWs=; b=g9fHIXzuEAXge5FouF+VNJpwF+mtO7YpI9kcO2e945uPIBRt6NK/W8py8mcjSUzYQH3OMa Qn/RS20/5cUB+G2rpWH+R35vqH3JAC4DhS2/yY/lMspWIs73hyohwceyGXVOwmRK8gCWUz DtcW8jPXT0SCweophEt2NEvTuC5cXtw= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b=CcluRvUh; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf11.hostedemail.com: domain of sashiko-bot@kernel.org designates 172.105.4.254 as permitted sender) smtp.mailfrom=sashiko-bot@kernel.org Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 451EB60120; Sat, 5 Dec 2026 04:09:11 +0000 (UTC) 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-Stat-Signature: i174jx3fy18eddd8jofab1n4si4nqrbp X-Spam-Status: No, score=-11.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Rspam-User: X-Rspamd-Queue-Id: C39BE4000A X-Rspamd-Server: rspam07 X-HE-Tag: 1796443751-619671 X-HE-Meta: U2FsdGVkX1+plCKq+HHCxvjwozaYvQkb9z9ImWumng9FoGbiiuy+cXOaC+7msj6dTPd9piAJMYQc5HzJ4hoiLGh4odBXjTsVo3DxBwlglOtoTZFu9HRn1iWJctbHjfnlO4Xgsa7UkD6mHjHgLHyk4GedKOG93p3gdm5qQzyBslsPkvGerpqBYWDHkqS7crnrdhUmotHLrjk4WwOI0iQXm0/URGO4U3g3dW9ZwWHx+WggK+WQxnq8lC2Z4V1DWrOrCrwrlgN9S/KeUZd3L9I0H9eKfw9EiJBy4yV03Z1oQtYXfXuYMVhCYyQ7In9fDmAS+aU6oMl3WPmEYbC2kXma4nHTu/AcJ159GrAaj3E4wVdlBE1q5evh+/v3XipAgnqBWeGHEDDPaqJoGDmuUDgHExLvbCr+utWis+HGVVxN1c/ZuXCBN6PyOsfWffTm6JQD68WfrJYJejr23vqLz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y2/vbRhsYLBoypHRhz/PGAzxXAhFkV56XT9YPJzP0tm+VKAoQWMg/rFg/JVJkh6OA2ApJV4uGIVQcSwcqHBcshhsAE3Qan5p3QMlE/uWAf/0zloAmeGlb7DyGtMJuMtmPZpjAdGlfJ/7c/KUQkcw4hvKS7dbCh8ENfxJvHd469dLIDmEDBz0EWsRUALO/ovujPClIBYPwpd7+CgQNHOgRPMzcNdBqhRlA5YoOAL4WWW72kGEEL6FuOrDzXt3VVzf2EJcJX8pqkfBKTKdFBwvrUw6iIvVc/lF9LBBJaMXGieQx+NU3FhyoYKAViki4qydh/aNWjRY Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: 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