From: "Serge E. Hallyn" <serge@hallyn.com>
To: Jinjie Ruan <ruanjinjie@huawei.com>
Cc: kees@kernel.org, akpm@linux-foundation.org, david@kernel.org,
ljs@kernel.org, liam@infradead.org, vbabka@kernel.org,
rppt@kernel.org, surenb@google.com, mhocko@suse.com,
mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
vschneid@redhat.com, kprateek.nayak@amd.com, paul@paul-moore.com,
jmorris@namei.org, shuah@kernel.org, oleg@redhat.com,
brauner@kernel.org, alexjlzheng@tencent.com, jannh@google.com,
jaime.saguillo@gmail.com, elver@google.com, blbllhy@gmail.com,
bvanassche@acm.org, pjw@kernel.org, broonie@kernel.org,
debug@rivosinc.com, tglx@kernel.org,
aleksey.oladko@virtuozzo.com, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org,
linux-security-module@vger.kernel.org, linux-mm@kvack.org,
linux-kselftest@vger.kernel.org, morgan@kernel.org
Subject: Re: [RFC PATCH v2 0/3] security: Add PR_CAPBSET_DROP_MASK
Date: Tue, 13 Oct 2026 09:09:07 -0500 [thread overview]
Message-ID: <as47g9Ofa7hgDDLp@hallyn.com> (raw)
In-Reply-To: <20260929130200.1638343-1-ruanjinjie@huawei.com>
On Tue, Sep 29, 2026 at 09:01:57PM +0800, Jinjie Ruan wrote:
> PR_CAPBSET_DROP only affects the calling thread, so dropping capabilities
> for a whole process means one call per capability per thread. For a
> long-lived, multi-threaded process such as gVisor's sentry this is
> stop-the-world signal delivery and costs milliseconds per sandbox on a
> many-core host.
>
> This series adds PR_CAPBSET_DROP_MASK, which removes a 64-bit mask of
> capabilities from the whole thread group in a single call. The drop is
> recorded per thread group and folded into the bounding set wherever it
> gates gaining a capability, so already-running, concurrently-created and
> later-created threads -- as well as children forked by a sibling -- all
> observe it.
>
> Trimming 41 capabilities in an arm64 KVM guest goes from ~8.5-23.6ms with
> the per-thread loop to ~11-14us, independent of the thread count.
>
> Changes in RFC v2:
> - Solve concurrently clone and concurrently drop mask problem.
> - Solove sashiko problems in [1].
> - Link to RFC v1: https://lore.kernel.org/all/20260922095816.1191799-1-ruanjinjie@huawei.com/
> [1] https://sashiko.dev/#/patchset/20260922095816.1191799-1-ruanjinjie%40huawei.com
Sorry, somehow I didn't notice this version until today. I will take
a close look later this week. Thanks.
> Jinjie Ruan (3):
> capability: Move mk_kernel_cap() to header
> security: Add PR_CAPBSET_DROP_MASK for process-wide bounding-set drops
> selftests: prctl: add process-wide bounding-set drop tests
>
> fs/proc/array.c | 3 +-
> include/linux/capability.h | 10 +
> include/linux/sched/signal.h | 8 +
> include/uapi/linux/prctl.h | 1 +
> kernel/capability.c | 5 -
> kernel/fork.c | 1 +
> security/commoncap.c | 91 ++-
> tools/testing/selftests/prctl/Makefile | 12 +-
> .../selftests/prctl/cap-bset-drop-test.c | 641 ++++++++++++++++++
> 9 files changed, 759 insertions(+), 13 deletions(-)
> create mode 100644 tools/testing/selftests/prctl/cap-bset-drop-test.c
>
> --
> 2.34.1
prev parent reply other threads:[~2026-10-13 14:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-29 13:01 [RFC PATCH v2 0/3] security: Add PR_CAPBSET_DROP_MASK Jinjie Ruan
2026-09-29 13:01 ` [RFC PATCH v2 1/3] capability: Move mk_kernel_cap() to header Jinjie Ruan
2026-09-29 13:06 ` sashiko-bot
2026-09-29 17:15 ` Bradley Morgan
2026-09-29 13:01 ` [RFC PATCH v2 2/3] security: Add PR_CAPBSET_DROP_MASK for process-wide bounding-set drops Jinjie Ruan
2026-09-29 13:19 ` sashiko-bot
2026-09-29 13:02 ` [RFC PATCH v2 3/3] selftests: prctl: add process-wide bounding-set drop tests Jinjie Ruan
2026-09-29 13:11 ` sashiko-bot
2026-10-13 14:09 ` Serge E. Hallyn [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=as47g9Ofa7hgDDLp@hallyn.com \
--to=serge@hallyn.com \
--cc=akpm@linux-foundation.org \
--cc=aleksey.oladko@virtuozzo.com \
--cc=alexjlzheng@tencent.com \
--cc=blbllhy@gmail.com \
--cc=brauner@kernel.org \
--cc=broonie@kernel.org \
--cc=bsegall@google.com \
--cc=bvanassche@acm.org \
--cc=david@kernel.org \
--cc=debug@rivosinc.com \
--cc=dietmar.eggemann@arm.com \
--cc=elver@google.com \
--cc=jaime.saguillo@gmail.com \
--cc=jannh@google.com \
--cc=jmorris@namei.org \
--cc=juri.lelli@redhat.com \
--cc=kees@kernel.org \
--cc=kprateek.nayak@amd.com \
--cc=liam@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-security-module@vger.kernel.org \
--cc=ljs@kernel.org \
--cc=mgorman@suse.de \
--cc=mhocko@suse.com \
--cc=mingo@redhat.com \
--cc=morgan@kernel.org \
--cc=oleg@redhat.com \
--cc=paul@paul-moore.com \
--cc=peterz@infradead.org \
--cc=pjw@kernel.org \
--cc=rostedt@goodmis.org \
--cc=rppt@kernel.org \
--cc=ruanjinjie@huawei.com \
--cc=shuah@kernel.org \
--cc=surenb@google.com \
--cc=tglx@kernel.org \
--cc=vbabka@kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
/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