From: Justin Suess <utilityemal77@gmail.com>
To: "Mickaël Salaün" <mic@digikod.net>
Cc: gnoack3000@gmail.com, linux-kernel@vger.kernel.org,
linux-security-module@vger.kernel.org
Subject: Re: [PATCH v2 1/3] landlock: Add LANDLOCK_RESTRICT_SELF_NO_NEW_PRIVS
Date: Fri, 31 Jul 2026 18:43:02 -0400 [thread overview]
Message-ID: <am0jI4LruRrmfD6h@zenbox> (raw)
In-Reply-To: <20260731.gagai6she3So@digikod.net>
On Fri, Jul 31, 2026 at 11:29:28PM +0200, Mickaël Salaün wrote:
> I like this series.
>
Thanks!
> On Fri, Jul 17, 2026 at 06:03:17PM -0400, Justin Suess wrote:
> > Add a landlock_restrict_self(2) flag to set the no_new_privs attribute
> > of the calling thread atomically with the enforcement of the ruleset:
>
> It looks atomic from the caller, but really this bit is set iff the
> ruleset enforcement succeed and before the call returns. Even for user
> space, when we'll have an introspection interface (e.g. tracepoints),
> user space could see inconsistencies wrt /proc/pid/status showing NNP
> because both operations are not atomic.
>
True, I did not consider the tracepoint perspective. Words mean things,
so "atomic" isn't the best choice of words when it's really an ordering
guarantee. (nnp set if and only if enforcement already succeeded).
I'll send a revised version next week (I don't have any objections to
any of your proposed changes)
Justin
> > no_new_privs is set if and only if the call succeeds. This removes the
> > need for a prior prctl(2) PR_SET_NO_NEW_PRIVS call and guarantees that a
> > failed enforcement leaves the attribute unchanged.
> >
> > Because no_new_privs is set by the call itself, the no_new_privs /
> > CAP_SYS_ADMIN requirement of landlock_restrict_self(2) is fulfilled by
> > construction, and the related EPERM check is skipped. As a consequence,
> > an unprivileged caller passing unknown flags along with this flag gets
> > EINVAL instead of EPERM.
> >
> > The attribute is only set past the last point of failure, just before
> > committing the new credentials. When combined with
> > LANDLOCK_RESTRICT_SELF_TSYNC, no_new_privs is set on the sibling threads
> > as well, in their commit phase, with the same atomicity.
> >
> > Bump the Landlock ABI version to 11.
> >
> > Cc: Mickaël Salaün <mic@digikod.net>
> > Signed-off-by: Justin Suess <utilityemal77@gmail.com>
> > ---
> > include/uapi/linux/landlock.h | 13 +++++++++++++
> > security/landlock/limits.h | 2 +-
> > security/landlock/syscalls.c | 28 +++++++++++++++++++++-------
> > security/landlock/tsync.c | 8 ++++++--
> > security/landlock/tsync.h | 4 +++-
> > 5 files changed, 44 insertions(+), 11 deletions(-)
next prev parent reply other threads:[~2026-07-31 22:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-17 22:03 [PATCH v2 0/3] Implement LANDLOCK_RESTRICT_SELF_NO_NEW_PRIVS Justin Suess
2026-07-17 22:03 ` [PATCH v2 1/3] landlock: Add LANDLOCK_RESTRICT_SELF_NO_NEW_PRIVS Justin Suess
2026-07-31 21:29 ` Mickaël Salaün
2026-07-31 22:43 ` Justin Suess [this message]
2026-07-17 22:03 ` [PATCH v2 2/3] selftests/landlock: Test LANDLOCK_RESTRICT_SELF_NO_NEW_PRIVS Justin Suess
2026-07-31 21:29 ` Mickaël Salaün
2026-07-17 22:03 ` [PATCH v2 3/3] landlock: Document LANDLOCK_RESTRICT_SELF_NO_NEW_PRIVS Justin Suess
2026-07-31 21:34 ` Mickaël Salaün
2026-07-31 21:28 ` [PATCH v2 0/3] Implement LANDLOCK_RESTRICT_SELF_NO_NEW_PRIVS Mickaël Salaün
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=am0jI4LruRrmfD6h@zenbox \
--to=utilityemal77@gmail.com \
--cc=gnoack3000@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=mic@digikod.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.