From: sashiko-bot@kernel.org
Cc: linux-security-module@vger.kernel.org
Subject: Re: [PATCH v6 1/6] userns: record how far up CAP_SETFCAP reaches
Date: Mon, 26 Oct 2026 15:48:54 +0000 [thread overview]
Message-ID: <sashiko-outbox-185460@kernel.org> (raw)
In-Reply-To: <20261026-b4-setfcap-userns-v6-1-25f10b7ca497@toxicpanda.com>
> create_user_ns() records in ns->parent_could_setfcap whether the creator
> had CAP_SETFCAP in its effective set, and verify_root_map() trusts that
> when a task in the new namespace maps the parent's uid 0. A bool only
> describes the parent, though. File capabilities belong to the kuid of a
> root user, and a namespace that maps the parent's uid 0 shares that kuid
> with the parent and possibly with ancestors further up, so what matters
> is how far up the creator's CAP_SETFCAP counted.
>
> Replace the bool with ns->setfcap_level: CAP_SETFCAP held in the
> namespace counts there and in its ancestors up to the one at that
> ->level. cap_setfcap_level() computes it from the creator's cred. A
> creator that holds CAP_SETFCAP passes on the setfcap_level of its own
> namespace, one that doesn't gets the new namespace's own level, and the
> initial namespace has 0.
>
> verify_root_map() keeps checking the same condition: the bool was false
> exactly when the level is the namespace's own.
>
> No functional change.
>
> Reviewed-by: Bradley Morgan <brads@mainlining.org>
> Assisted-by: LLM
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261026-b4-setfcap-userns-v6-0-25f10b7ca497@toxicpanda.com?part=1
next prev parent reply other threads:[~2026-10-26 15:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-26 15:41 [PATCH v6 0/6] capabilities: close the ways around the CAP_SETFCAP rule for uid 0 Josef Bacik
2026-10-26 15:41 ` [PATCH v6 1/6] userns: record how far up CAP_SETFCAP reaches Josef Bacik
2026-10-26 15:48 ` sashiko-bot [this message]
2026-10-26 15:41 ` [PATCH v6 2/6] userns: don't let setns() lend CAP_SETFCAP Josef Bacik
2026-10-26 15:54 ` sashiko-bot
2026-10-26 15:41 ` [PATCH v6 3/6] userns: check the opener and the writer before mapping uid 0 Josef Bacik
2026-10-26 16:00 ` sashiko-bot
2026-10-26 15:41 ` [PATCH v6 4/6] capabilities: limit fscaps to where CAP_SETFCAP reaches Josef Bacik
2026-10-26 16:05 ` sashiko-bot
2026-10-26 15:41 ` [PATCH v6 5/6] capabilities: don't let ptrace borrow CAP_SETFCAP Josef Bacik
2026-10-26 15:56 ` sashiko-bot
2026-10-26 15:41 ` [PATCH v6 6/6] selftests/namespaces: test the CAP_SETFCAP rule for user namespaces Josef Bacik
2026-10-26 16:00 ` sashiko-bot
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=sashiko-outbox-185460@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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