Linux Security Modules development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
Cc: linux-security-module@vger.kernel.org
Subject: Re: [PATCH v8 6/6] selftests/namespaces: test the CAP_SETFCAP rule for user namespaces
Date: Tue, 27 Oct 2026 14:33:20 +0000	[thread overview]
Message-ID: <sashiko-outbox-186726@kernel.org> (raw)
In-Reply-To: <20261027-b4-setfcap-userns-v8-6-2674adc63f3c@toxicpanda.com>

> Add tests for who may map the root user of an ancestor user namespace,
> write file capabilities that are honoured in an ancestor, join a
> namespace whose tasks may do so, or attach to such a task.
> 
> Each case runs as root in a private mount namespace with a tmpfs on
> /tmp.  It sets up everything but the step it tests and fails if any of
> that goes wrong, so a refusal comes from that step.  The ones that must
> be refused are the ways around the rule that the preceding patches
> close: setns() into a namespace created with CAP_SETFCAP, a uid_map fd
> opened by somebody else, pidfd_getfd(), a writer inside the namespace
> that gave up CAP_SETFCAP, the root user of an ancestor mapped at a
> non-zero uid, v2 and v3 xattrs written after a privileged task mapped
> uid 0 for a namespace created without CAP_SETFCAP, a joiner of such a
> namespace, and PTRACE_ATTACH.  A task that joins a namespace gets
> CAP_SETFCAP wherever the namespace's creator had it, so the setns()
> cases end at setns().  The ones that must keep working are a task
> mapping its own namespace, a privileged task mapping it from the
> parent, unprivileged users nesting namespaces, joiners that have
> CAP_SETFCAP, file capabilities in all of those, containers that don't
> map host uid 0, and idmapped mounts of a container's rootfs.  Where
> file capabilities are written the test also checks whether uid 1000
> gets CAP_SYS_ADMIN from them, by running a copy of itself.
> 
> The idmapped mount cases skip when tmpfs can't be idmapped, and the
> session keyring case when the kernel has no keyrings.
> 
> 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/20261027-b4-setfcap-userns-v8-0-2674adc63f3c@toxicpanda.com?part=6


      reply	other threads:[~2026-10-27 14:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-27 14:22 [PATCH v8 0/6] capabilities: close the ways around the CAP_SETFCAP rule for uid 0 Josef Bacik
2026-10-27 14:22 ` [PATCH v8 1/6] userns: record how far up CAP_SETFCAP reaches Josef Bacik
2026-10-27 14:33   ` sashiko-bot
2026-10-27 14:22 ` [PATCH v8 2/6] userns: don't let setns() lend CAP_SETFCAP Josef Bacik
2026-10-27 14:41   ` sashiko-bot
2026-10-27 14:22 ` [PATCH v8 3/6] userns: check the opener and the writer before mapping uid 0 Josef Bacik
2026-10-27 14:40   ` sashiko-bot
2026-10-27 14:22 ` [PATCH v8 4/6] capabilities: limit fscaps to where CAP_SETFCAP reaches Josef Bacik
2026-10-27 14:39   ` sashiko-bot
2026-10-27 14:22 ` [PATCH v8 5/6] capabilities: don't let ptrace borrow CAP_SETFCAP Josef Bacik
2026-10-27 14:37   ` sashiko-bot
2026-10-27 14:22 ` [PATCH v8 6/6] selftests/namespaces: test the CAP_SETFCAP rule for user namespaces Josef Bacik
2026-10-27 14:33   ` sashiko-bot [this message]

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-186726@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