Article View: linux.kernel.netdev
Article #8531Re: [PATCH 0/8] userns: per-namespace capability bounding set and opt-in netns loopback
From: Alexey Gladkov
Date: Thu, 29 Oct 2026 10:44
Date: Thu, 29 Oct 2026 10:44
89 lines
12917 bytes
12917 bytes
On Wed, Oct 28, 2026 at 03:56:11PM -0700, Andy Lutomirski wrote: > On Wed, Oct 28, 2026 at 3:18 PM Hallgrimur H. Gunnarsson > <halg@google.com> wrote: > > > > When an unprivileged process creates a new user namespace, it is granted > > a full set of capabilities (CAP_FULL_SET) scoped to that namespace. > > While these capabilities are isolated to the namespace, they allow > > unprivileged local users to reach deep kernel subsystems (most notably > > networking configuration and raw sockets via CAP_NET_ADMIN and > > CAP_NET_RAW) that historically assumed a trusted caller and have > > accounted for a large share of local privilege escalation > > vulnerabilities. > > > > Many workloads and sandboxes use unprivileged user namespaces strictly > > for basic UID/GID, mount, PID, or network isolation and never need > > high-risk capabilities like CAP_NET_ADMIN or CAP_NET_RAW. Likewise, > > system administrators often want a host-wide policy ceiling restricting > > which capabilities unprivileged user namespaces may acquire, without > > disabling unprivileged user namespaces altogether. > > > > Prior work by Jonathan Calmels [1] proposed addressing this via a sixth > > per-thread capability set (cap_userns) alongside a global sysctl mask. > > During that discussion [1, 2], feedback (e.g. from Casey Schaufler) > > suggested that rather than adding another per-thread capability set and > > prctl() interface, capability restrictions could be integrated directly > > into struct user_namespace and configured via clone3(). At the same > > time, as noted in [1], a clone3() flag alone is not sufficient for > > administrators who need to enforce a host-wide ceiling on unprivileged > > user namespaces without modifying every userspace callsite. > > > > This series combines both pieces of feedback: it embeds a capability > > bounding set (cap_bset) directly into struct user_namespace, reusing > > the existing task cap_bset, cap_permitted, and cap_effective sets on > > namespace entry, and provides both a system-wide sysctl ceiling for > > unprivileged user namespaces and a CLONE_NEWUSER_BSET flag for > > voluntary per-namespace restriction via clone3(). > > Why should the task's cap masks affect this? *Maybe* cap_bset makes > sense, but I'm struggling a bit to see why cap_permitted and > cap_effective should matter. > > Also, I think that Docker in non-userns mode restricts cap_bset, and > the purpose of that restriction is rather at odds with interpreting it > as a restriction on newly created user namespaces for purposes of > vulnerability mitigation. > > > > > In addition, because restricting CAP_NET_ADMIN at user namespace > > creation time prevents userspace from bringing up the loopback > > interface in new network namespaces, the series first introduces > > an opt-in flag to automatically enable loopback on network namespace > > creation: > > > > 1. Opt-in loopback activation on netns creation (Patch 1) > > > > New network namespaces start with the loopback interface (lo) DOWN by > > default, requiring CAP_NET_ADMIN over the owning user namespace to > > bring it up. To block external network access while preserving > > localhost networking, sandboxes commonly create an isolated network > > namespace with only the loopback interface enabled. > > > > The whole unshare/clone flag situation is getting out of hand, IMO. > And this new thing makes logical sense but is really about reducing > exposure. > > Perhaps we should instead have a small list associated with a userns > (extensible in the future) of things that the ns's admin (i.e. whoever > has CAP_SYS_ADMIN relative to the ns) may do. That list could > include: > > - Create loopback with sensible defaults for ipv4 and/or ipv6 (i see > no obvious reason to separate them) > - Create tun/tap interfaces in that ns (and attach them, etc) > > And add a very simple new API to do these things. Actually, the > tun/tap could just use the normal mechanism. > > Thoughts? I think that's an interesting idea. I also think the whole flag issue is moving in the wrong direction. Are you thinking of something like `struct open_how` in openat2, or something else? -- Rgrds, legion
Technical Details
Message-ID:
<auMjpJwXQJyXr3fW@example.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-353248-linux-kernel-netdev=dewy.ruReferences:
<20261028221705.3915340-1-halg@google.com> <CALCETrW9ygriu54gxiHFLEd5+hJminQo0r8Jwd63wR69Dj4W7w@mail.gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-353248-linux-kernel-netdev=dewy.ru From: legion@kernel.org (Alexey Gladkov) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH 0/8] userns: per-namespace capability bounding set and opt-in netns loopback Date: Thu, 29 Oct 2026 11:44:52 +0100 Organization: Usenet Network Message-ID: <auMjpJwXQJyXr3fW@example.org> References: <20261028221705.3915340-1-halg@google.com> <CALCETrW9ygriu54gxiHFLEd5+hJminQo0r8Jwd63wR69Dj4W7w@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1988366"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:lkxa12+xlD/0tYiQqpwY9Juoac0= sha256:O1ZygFJINuawyNIfoLsbXYQqe2zQLt7nzfPNZaWHSUE= sha1:cATHg88rSKZnPyqtdgEUjtbcEYM= sha256:0lnZJ+tcJHxb1XGCbe4DccOlwBQZUMBPhy9Hz/eoZIA= Content-Disposition: inline List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 89FD0125C62; Thu, 29 Oct 2026 13:49:47 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NRV4ZsrXk8Cu; Thu, 29 Oct 2026 13:49:45 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-353248-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id 726EF125C5D; Thu, 29 Oct 2026 13:49:35 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sin.lore.kernel.org (Postfix) with ESMTP id 0EFA327D2B; Thu, 29 Oct 2026 10:45:15 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1793270713; b=fFVwfxaHfGrA8VqsS0j5AyNFO/L1RyYAfPKvWwSdo16EQWMJnISbg1QoAu233hsHAQ2H U3AYIUNw+K9FQUNY0qIY82CARPq8T9OgyYUvFp1U/1WXiM4lJR/F1yLPMKZf8XmZPvn5q HuWH9dS4fRbrgFjGRDjfmGemmRG2YXzwEkB6z3BACMhLzJXSbyP3lURutXj34t0QzoRGc NCv7YClDo2n1PRHNQN0zhManQJ1AwcekOABFMz7XjiXYf5sVq0SOsEad00mdAGIPqN9Dv lhVAPaOstjw9JGe6G3IPUPAypgEza0TyYsqBksUupXGQWVHWfkL3030xORmG7Ml+K5w== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793270713; h=X-Original-To:Received:Received:DKIM-Signature:Date:From:To:Cc: Subject:Message-ID:References:X-Mailing-List:List-Id:List-Post: List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence: MIME-Version:Content-Type:Content-Disposition: Content-Transfer-Encoding:In-Reply-To; bh=0dCSBHfUVHBP5GH3Zssr2yssdn3VkCL1gUTLqNUcb1c=; b=rnAFWhlI4Ug9ak9TBaclS17+Kqm6QMBk7dquhuJ1PYfbLt+rCkxdsFWc3AzsVjzLwYyT H4q5F4KaN1lllA0337PpwzUK+kt1ktIxmxZl9SmZS+iHdgxvPEtlBUUZcYtVQE/AWtBdH vPpRt3zvX7vdDTc0Ol57jGLmh9yCPn3cd1MNCSrh/lUUlIHl0nVv3o9E1E13OiArolnSK mf8n72yXNDAbKJSx+VrzS0M7MdjHSIB/x/yfj1lv8Wt9Cz7KzbX5K+Omf4qpxonoMiLy4 1Y7N9Jk9Djbw29WDUTqiKzTor6r8qp8rR7K5BqJCgWKMbe0Lg1zinBuBAtJgitbdaZA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=nxT2VMz4; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AD73C606A327; Thu, 29 Oct 2026 10:45:13 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=nxT2VMz4 X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793270702; b=29aSHhEbSCZ31xSBfJv5K9muDjmAIwbI7ONCwTf+UmzIW5XW6AKU6bRP8BvfzpXvUL9S BmogCBMVyeYEIkrxeDMXMhVqYb0YnzpeGZG2Nqg2w5RpcLmGwZZDtO+A6x4GgaWrVoyC5 LNi84jlRLbDwvx8CtcGIgOrFoD6kDli6fxLlmIiQ+yia97t3rOKgGbftrmML2ZiNwnBt2 bjhM3RlE0RfBy5E/pqbb+0IYIErtM/JGrnW8EVfhq9cLAp5uEjtafP1cc9DCb4VjpDsja w5bqvFP43KECG/F6Ks08/PntMHFHxBqPhtc9RSJah8wQXUibLGgRPwrcjwTGNc+DBCg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793270702; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition: Content-Transfer-Encoding:In-Reply-To; bh=0dCSBHfUVHBP5GH3Zssr2yssdn3VkCL1gUTLqNUcb1c=; b=3g0GjEFfFfK3bdiVjF2Fdb1J/4Gm/QksdLuuGkVBI3y1WFvMmkuKsMhRgl9+7dQ31pTb x68yyDC9/YCvxZdyjSg8mBO4O9U1DZ2p1uoyLXYbIfuL2fND+gsPh2VZIHqYJIZ4bLEJB cwtFFLmlqVwI7sQjphZTEKksfsg0+Eeemt80AhFHATnh/GBKRQKNzbjtZU/15ltKI+FWk PLCQ8z7FaZ4XKK9cMc9zFSWVndQpch6bGIuIoSx3KO2ohdWfVeuRzHnY7vHM5Kp++wBg6 2Oblunedc5SjdW5JBeD7GE9T/DyiDYP8rz1fgDRI3o9N9gZNj+NJfBfjqCn4FBzviwA== X-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=nxT2VMz4; arc=none smtp.remote-ip=100.103.45.18 X-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 8CBDD606A31F; Thu, 29 Oct 2026 10:45:02 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 569071F031E2; Thu, 29 Oct 2026 10:44:56 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793270702; bh=0dCSBHfUVHBP5GH3Zssr2yssdn3VkCL1gUTLqNUcb1c=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=nxT2VMz4fnyBGepb2y6DIfK6SE3t2B76Yk1hsA8J6xw19WDTRWQkc5zer0rtHjzZQ Gb5inbSwozgewNJrlxHySAlYyumEcf2I2H89YJtQ2mKV0FR1qRmlFr6921WsPFWLvf mDO6xtXeNV75v/I7AsXrq4ElCmke3k3ksppR2nVk6RK7nwvVoDAMyGrK3MqSVHCrLS tx08eVD4EuQq6XQyn5UuT1nZTBQdXegs6VSSweVrPGuWGxNOLxCoSSp+LhLfxnwPRU jvL20xWFcOw1tu/0Ngm+yTfllKoTUKGa6bFKvqepHlY87fecj0Xp5xBmzDsbE6PVCD GcxWud5QzBBKw== X-Cc: "Hallgrimur H. Gunnarsson" <halg@google.com>, Christian Brauner <brauner@kernel.org>, Alexander Viro <viro@zeniv.linux.org.uk>, Paul Moore <paul@paul-moore.com>, Serge Hallyn <sergeh@kernel.org>, Kees Cook <kees@kernel.org>, "David S . Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Jan Kara <jack@suse.cz>, James Morris <jmorris@namei.org>, Simon Horman <horms@kernel.org>, Jonathan Corbet <corbet@lwn.net>, Shuah Khan <skhan@linuxfoundation.org>, Randy Dunlap <rdunlap@infradead.org>, Jann Horn <jannh@google.com>, Günther Noack <gnoack@google.com>, KP Singh <kpsingh@kernel.org>, Jonathan Calmels <jcalmels@3xx0.net>, Casey Schaufler <casey@schaufler-ca.com>, linux-fsdevel@vger.kernel.org, linux-security-module@vger.kernel.org, linux-api@vger.kernel.org, containers@lists.linux.dev, netdev@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-In-Reply-To: <CALCETrW9ygriu54gxiHFLEd5+hJminQo0r8Jwd63wR69Dj4W7w@mail.gmail.com>