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=1796095570; b=LVq2P3WDiQTRu8JsKvw/xW0Lc0vXZtX90mzpVeUK8etOc8IxvHA46Go1V8ps5WpWTbe8 GVqvB9nsDhOXZhdmMgoReABNEB58o5An+ZXqBCEMczd/nfOOIRKxhsP9zC/hyeE4zKRWn zv1KL6ncTtg8jgG4Y2ZdXuizvz9G/qqmAyQ81Xmt7YkH034KcgxwjFKQ/W6bOaGQ19qa5 0QDaALbNeaZdr0ng7UdGYHUGSSWb47oK1dAefiGLpMayI9qCgh2CZGCRtf582ftcDbCdK 32US8igK4gxkRPT24mh7CSdUaKph8rVJVbXFhCzgFhczNDUU5xUXsS9VD4Xm0dy4OQw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796095570; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=WBRrOj+k/47+8//7HQPCE19NKxTc++zLrbarSjmCeWc=; b=qFhGniM62EhCS1l7bOXPfR17YIKoMELDii1/WMy3h3FdCtoBEOrKLwB1D6JF1m2ZNoTK dmCEkkQafYOIKkxHfPofwgeSrV9aiKAKIPU7Kbv/r+BtBNkBPq/bPsni9Ix5slvZNimT0 yGrbu5TjMSoI4IONrsUP9z4GWizO308baYUQ8ri2BL6vm6gnT3y5H5Ec40EVSBEBng4Zw kD/bEf2+tb21oBbNSjz8Rbfh50iRex/2jY0zrEhgS5RGnhbfvP+P8Jtcd+LmqN4mrXP8s F30u5nFxDFppao8hMoEzMJsWQyXiE6xw7ZXPNMNAT9r2puLEeMU2XIWlswK6NLZZaWA== 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=dFRCxtRs; 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 3F7E3606A33A; Tue, 1 Dec 2026 03:26:09 +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=dFRCxtRs Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6BD31F000C1; Tue, 1 Dec 2026 03:26:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796095569; bh=WBRrOj+k/47+8//7HQPCE19NKxTc++zLrbarSjmCeWc=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=dFRCxtRsB8Sk7q45eXioBLfpGdm50wC6EGF9zkngaU+JKjoQ4IjW0z6f1F0z6wo/L 9QqyWtLNdT/B6on7xEcDH2xtr8EoT6Ookk/T5LQmAUy/7lkx2e4MWFw//Kl99mIHop gE8asi+4bqO7Bxtts09aSijdeloQGTGlywoP9dgQp4Y8nUwLd+cBxna6b+IS3ygf5l 7YtfkskB4PIWlk0ENozhqpHIQpY4Y9aruhZsZfubAAcwzjs39BF0RM3Tv+KZ0O+9zt n+zAPJ2JnAYOLPRpd8b+SeJEvD9mcTApZ+szAEwikjkFzqygM/VKCaL3OJ5LCWPNWn /LaFjTjrT/V4Q== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [RFC PATCH v9 02/29] userns: Add userns_set_idmap() system call 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: <20261201031002.593830-3-jarkko@kernel.org> References: <20261201031002.593830-1-jarkko@kernel.org> <20261201031002.593830-3-jarkko@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 01 Dec 2026 03:26:06 +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 1 potential issue to consider: - [Medium] userns: caller_idmap_permitted() rejects delegated projid_map without CAP_SETUID -- commit 58bf5f681d11a23cb6edc84d8207c82688e2ecbb Author: Jarkko Sakkinen userns: Add userns_set_idmap() system call This commit adds the userns_set_idmap() system call to atomically configure UID, GID, and project ID mappings as well as the setgroups policy on a user namespace file descriptor. > diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c > index caba2ac33077e..e5054e273e939 100644 > --- a/kernel/user_namespace.c > +++ b/kernel/user_namespace.c [ ... ] > @@ -1176,6 +1180,228 @@ static ssize_t map_write(struct file *file, const= char __user *buf, > return ret; > } > =20 > +static bool caller_idmap_permitted(struct user_namespace *ns, int cap_se= tid, > + unsigned long ns_flags, > + const struct uid_gid_map *new_map) > +{ > + const struct cred *cred =3D current_cred(); > + > + if (cap_setid =3D=3D CAP_SETUID && idmap_maps_root(new_map)) { > + if (cred->user_ns =3D=3D ns) { > + if (!ns->parent_could_setfcap) > + return false; > + } else { > + if (!ns_capable(ns->parent, CAP_SETFCAP)) > + return false; > + } > + } > + > + if (unpriv_idmap_permitted(ns, cred, cap_setid, ns_flags, new_map)) > + return true; > + > + if (!cap_valid(cap_setid)) > + return ns_capable(ns, CAP_SYS_ADMIN) || > + ns_capable(ns->parent, CAP_SETUID); [Severity: Medium] Should !cap_valid(cap_setid) return true here, matching new_idmap_permitted= () for project ID mappings? sys_userns_set_idmap() already verifies that either the caller or the file opener holds CAP_SYS_ADMIN in ns, and project ID mappings do not require any parent namespace capability. Requiring the caller itself to hold CAP_SYS_ADMIN in ns or CAP_SETUID in ns->parent causes configuring projid_extents via a delegated userns fd to fail with -EPERM when the caller does not have CAP_SETUID (for example, an unprivileged process or a helper holding only CAP_SETGID). --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261201031002.5938= 30-1-jarkko@kernel.org?part=3D2