Linux userland API discussions
 help / color / mirror / Atom feed
From: Casey Schaufler <casey@schaufler-ca.com>
To: Jarkko Sakkinen <jarkko@kernel.org>
Cc: "Andy Lutomirski" <luto@amacapital.net>,
	"Andy Lutomirski" <luto@kernel.org>,
	"Hallgrimur H. Gunnarsson" <halg@google.com>,
	"Christian Brauner" <brauner@kernel.org>,
	"Serge Hallyn" <sergeh@kernel.org>,
	"Paul Moore" <paul@paul-moore.com>,
	"James Morris" <jmorris@namei.org>,
	"David Howells" <dhowells@redhat.com>,
	"Kees Cook" <kees@kernel.org>, "Jonathan Corbet" <corbet@lwn.net>,
	"Shuah Khan" <skhan@linuxfoundation.org>,
	"Randy Dunlap" <rdunlap@infradead.org>,
	"Mickaël Salaün" <mic@digikod.net>,
	"Jonathan Calmels" <jcalmels@3xx0.net>,
	"Jann Horn" <jannh@google.com>,
	"Günther Noack" <gnoack@google.com>,
	"Singh KP" <kpsingh@kernel.org>,
	linux-fsdevel@vger.kernel.org,
	linux-security-module@vger.kernel.org, linux-api@vger.kernel.org,
	containers@lists.linux.dev, keyrings@vger.kernel.org,
	linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	"Casey Schaufler" <casey@schaufler-ca.com>
Subject: Re: [PATCH v2 1/4] userns: introduce capability bounding set for user namespacesg
Date: Mon, 23 Nov 2026 13:58:41 -0800	[thread overview]
Message-ID: <6a0539de-1a66-4dfd-a21d-aee48ab18f3f@schaufler-ca.com> (raw)
In-Reply-To: <awSVO9Zc-233M7_P@kernel.org>

On 11/23/2026 11:35 AM, Jarkko Sakkinen wrote:
> On Mon, Nov 23, 2026 at 09:22:29AM -0800, Casey Schaufler wrote:
>> On 11/20/2026 9:09 AM, Andy Lutomirski wrote:
>>>> On Nov 19, 2026, at 2:52 PM, Andy Lutomirski <luto@kernel.org> wrote:
>>>> On Thu, Nov 19, 2026 at 2:43 AM Hallgrimur H. Gunnarsson
>>>> <halg@google.com> wrote:
>>>>> When a process creates a new user namespace, it receives a full set of
>>>>> capabilities (CAP_FULL_SET) scoped to that namespace. While namespaced
>>>>> in scope, several of these capabilities (such as CAP_NET_ADMIN and
>>>>> CAP_NET_RAW) expose broad kernel attack surface that many sandboxes and
>>>>> containers never need. However, there is currently no configurable way
>>>>> to withhold such capabilities from user namespaces while still granting
>>>>> them to workloads that require them.
>>>> One thought (from the rootns thread): the other decent sized attack
>>>> surface here is CAP_MOUNT_ADMIN.  Which doesn't exist as a capability
>>>> bit.
>>>>
>>>> A sort of horrible solution (but maybe not so awful) would be to
>>>> declare that the bits in cap_userns aren't actually capability bits,
>>>> and that you need the bit in cap_userns *and* the bit in cap_effective
>>>> to do sensitive things, and that mounting needs cap_userns to have
>>>> NSCAP_MOUNT_ADMIN *and* cap_effective to have CAP_SYS_ADMIN.
>>>>
>>>> I want to sleep on this.  It might actually solve several problems,
>>>> e.g. controlling creation of ipv4 and ipv6 loopback or tunnel devices
>>>> or whatever.
>>> I slept on it. Here’s a counterproposal.  I’m not saying I think this
>>> is better than this patch set, but I think it’s worth weighting the
>>> options.
>>>
>>> Define a whole new set of privilege bits.  As a
>>> poorly-painted-bikeshed option, I’ll call them eprivs (for exposure
>>> privileges - it’s a crappy name but at least it’s pronounceable).
>> I played with a mechanism I called "chits" (all the good terms for security
>> bits have been consumed for a very long time) that looks a lot like
>> what you're proposing. I did it to address the CAP_SYS_ADMIN problem,
>> where any use of the capability opens up a whole barrel of worms.
>> I cannot, unfortunately, find my patches. :( The basic approach is:
>>
>> A process has an optional set of chits. A process without a chit set is
>> unaffected by the mechanism. A process with a chit set is allowed only
>> those operations for which it has a chit. The existing but empty chit set
>> allows no operations. A process may drop a chit, but not the set, which,
>> again, can be empty.
>>
>> Because I was after CAP_SYS_ADMIN, I envisioned a call
>> 	cap_able_chit(capability, chit-list)
>> but there's no reason there couldn't be a
>> 	chit_able(chit-list)
>> as well.
>>
>> I wrote this as an LSM, but the system-wide aspect of it made that
>> a questionable choice.
>>
>> If you have any interest, I could dig more deeply to try to find the
>> patches. Otherwise, I'm happy to look at what you come up with.
> What if eprivs or chits would take each capability and subvidide
> them into pieces? CAP_MAC_ADMIN would be formally a set of chits
> (or eprivs).
>
> And process having e.g., CAP_MAC_ADMIN, would actually have the
> set of chits that are included to CAP_MAC_ADMIN.

That would require that chits have the same inheritance rules as
capabilities, and I think that's a really bad idea. I was an active
member of the P1003.1e/2c committee that defined capabilities, and
was a major advocate of their inclusion in Linux. I wish that I
could say they've been successful, but root still rules the roost.
I attribute that to the complexity that arose from trying to address
privilege via setuid and privilege bracketing at the same time.
Chits (or eprivs) as a finer granularity version of capabilities
would make granular privilege even harder to sell than it is now.

> Without that type of relation there's just a space full of chit
> ;-)

Which is one of the reasons I haven't published anything about them.
Even with the scheme being (a lot) simpler than capabilities I don't
see it as something I have the resources to complete. If Andy wants to
drive the process I'm willing to contribute where I can.

>
> Br, Jarkko

  parent reply	other threads:[~2026-11-23 21:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 10:42 [PATCH v2 0/4] userns: per-namespace capability bounding set Hallgrimur H. Gunnarsson
2026-11-19 10:42 ` [PATCH v2 1/4] userns: introduce capability bounding set for user namespaces Hallgrimur H. Gunnarsson
2026-11-19 15:05   ` Jarkko Sakkinen
2026-11-19 19:19     ` Hallgrimur H. Gunnarsson
2026-11-19 20:14       ` Jarkko Sakkinen
2026-11-19 22:52   ` Andy Lutomirski
2026-11-20 17:09     ` Andy Lutomirski
2026-11-23 17:22       ` Casey Schaufler
2026-11-23 19:35         ` [PATCH v2 1/4] userns: introduce capability bounding set for user namespacesg Jarkko Sakkinen
2026-11-23 19:38           ` Jarkko Sakkinen
2026-11-23 20:18             ` Jarkko Sakkinen
2026-11-23 21:58           ` Casey Schaufler [this message]
2026-11-23 22:52             ` Jarkko Sakkinen
2026-11-23 22:54               ` Jarkko Sakkinen
     [not found]   ` <sashiko-outbox-223014@kernel.org>
2026-11-20 11:35     ` [PATCH v2 1/4] userns: introduce capability bounding set for user namespaces Hallgrimur H. Gunnarsson
2026-11-19 10:42 ` [PATCH v2 2/4] capability: bound ptrace and cred subset checks by userns ceilings Hallgrimur H. Gunnarsson
2026-11-19 10:42 ` [PATCH v2 3/4] proc: expose userns capability mask as CapUns in /proc/<pid>/status Hallgrimur H. Gunnarsson
2026-11-19 10:42 ` [PATCH v2 4/4] selftests/capabilities: add userns capability bounding set tests Hallgrimur H. Gunnarsson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6a0539de-1a66-4dfd-a21d-aee48ab18f3f@schaufler-ca.com \
    --to=casey@schaufler-ca.com \
    --cc=brauner@kernel.org \
    --cc=containers@lists.linux.dev \
    --cc=corbet@lwn.net \
    --cc=dhowells@redhat.com \
    --cc=gnoack@google.com \
    --cc=halg@google.com \
    --cc=jannh@google.com \
    --cc=jarkko@kernel.org \
    --cc=jcalmels@3xx0.net \
    --cc=jmorris@namei.org \
    --cc=kees@kernel.org \
    --cc=keyrings@vger.kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=luto@kernel.org \
    --cc=mic@digikod.net \
    --cc=paul@paul-moore.com \
    --cc=rdunlap@infradead.org \
    --cc=sergeh@kernel.org \
    --cc=skhan@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox