From: "Mickaël Salaün" <mic@digikod.net>
To: Justin Suess <utilityemal77@gmail.com>
Cc: gnoack3000@gmail.com, linux-kernel@vger.kernel.org,
linux-security-module@vger.kernel.org
Subject: Re: [PATCH v2 3/3] landlock: Document LANDLOCK_RESTRICT_SELF_NO_NEW_PRIVS
Date: Fri, 31 Jul 2026 23:34:40 +0200 [thread overview]
Message-ID: <20260731.zoo0aeZ8iyee@digikod.net> (raw)
In-Reply-To: <20260717220320.1030123-4-utilityemal77@gmail.com>
On Fri, Jul 17, 2026 at 06:03:19PM -0400, Justin Suess wrote:
> Document atomically setting no_new_privs with ruleset enforcement,
> following the same compatibility section style as previous ABI
> additions.
>
> Signed-off-by: Justin Suess <utilityemal77@gmail.com>
> ---
> Documentation/userspace-api/landlock.rst | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/userspace-api/landlock.rst b/Documentation/userspace-api/landlock.rst
> index 5a63d4476c1c..ec87d35f4715 100644
> --- a/Documentation/userspace-api/landlock.rst
> +++ b/Documentation/userspace-api/landlock.rst
The tutorial in this doc should also be updated accordingly, taking into
account the best-effort approach and then the fallback to calling prctl.
First by updating the restrict_flags content according to the ABI
version, and then by updating the prctl block with something like this:
if (!(restrict_flags & LANDLOCK_RESTRICT_SELF_NO_NEW_PRIVS) &&
prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)) {
The saandboxer sample should also follow the same pattern.
> @@ -8,7 +8,7 @@ Landlock: unprivileged access control
> =====================================
>
> :Author: Mickaël Salaün
> -:Date: June 2026
> +:Date: July 2026
>
> The goal of Landlock is to enable restriction of ambient rights (e.g. global
> filesystem or network access) for a set of processes. Because Landlock
> @@ -789,6 +789,18 @@ when at least one sys_landlock_add_rule() call is made for it with the
> ``LANDLOCK_ADD_RULE_QUIET`` flag, additional add-rule calls for the same
> object without this flag do not clear it.
>
> +Atomic no_new_privs (ABI < 11)
> +------------------------------
You can just drop the "Atomic" in this title.
> +
> +Starting with the Landlock ABI version 11, sys_landlock_restrict_self()
> +accepts the ``LANDLOCK_RESTRICT_SELF_NO_NEW_PRIVS`` flag, which sets the
> +no_new_privs attribute of the calling thread atomically with the enforcement
It should be something like "all-or-nothing" instead of atomically, or
just describe the proprety.
> +of the ruleset: no_new_privs is set if and only if the call succeeds. This
> +removes the need for a prior :manpage:`prctl(2)` ``PR_SET_NO_NEW_PRIVS``
> +call, and with it the ``CAP_SYS_ADMIN`` requirement. When combined with
> +``LANDLOCK_RESTRICT_SELF_TSYNC``, no_new_privs is set on all threads of the
> +process.
One important point of this flag is that the NNP is only set if the
ruleset enforcement succeed (ordering).
Also, as discussed previously, it should be explicit in the doc that not
setting no_new_privs is risky even when it is not required, and this
flag makes it cheap to avoid.
> +
> .. _kernel_support:
>
> Kernel support
> --
> 2.54.0
>
next prev parent reply other threads:[~2026-07-31 21:34 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
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 [this message]
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=20260731.zoo0aeZ8iyee@digikod.net \
--to=mic@digikod.net \
--cc=gnoack3000@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=utilityemal77@gmail.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 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.