From: "Günther Noack" <gnoack3000@gmail.com>
To: "Panagiotis \"Ivory\" Vasilopoulos" <git@n0toose.net>
Cc: "Mickaël Salaün" <mic@digikod.net>,
"Günther Noack" <gnoack@google.com>,
"Jonathan Corbet" <corbet@lwn.net>,
"Shuah Khan" <skhan@linuxfoundation.org>,
linux-security-module@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org, "Dan Cojocaru" <dan@dcdev.ro>
Subject: Re: [PATCH v3] landlock: Expand restrict flags example for ABI version 8
Date: Tue, 3 Mar 2026 10:08:07 +0100 [thread overview]
Message-ID: <20260303.13455f40d0c5@gnoack.org> (raw)
In-Reply-To: <20260228-landlock-docs-add-tsync-example-v3-1-140ab50f0524@n0toose.net>
On Sat, Feb 28, 2026 at 10:36:59PM +0100, Panagiotis "Ivory" Vasilopoulos wrote:
> diff --git a/Documentation/userspace-api/landlock.rst b/Documentation/userspace-api/landlock.rst
> index 13134bccdd39d78ddce3daf454f32dda162ce91b..b71ac7aa308260b8141e5d35248fb68cec6dcba9 100644
> --- a/Documentation/userspace-api/landlock.rst
> +++ b/Documentation/userspace-api/landlock.rst
> @@ -196,13 +196,33 @@ similar backwards compatibility check is needed for the restrict flags
> (see sys_landlock_restrict_self() documentation for available flags):
>
> .. code-block:: c
> -
> - __u32 restrict_flags = LANDLOCK_RESTRICT_SELF_LOG_NEW_EXEC_ON;
> - if (abi < 7) {
> - /* Clear logging flags unsupported before ABI 7. */
> + __u32 restrict_flags =
> + LANDLOCK_RESTRICT_SELF_LOG_NEW_EXEC_ON |
> + LANDLOCK_RESTRICT_SELF_TSYNC;
> + switch (abi) {
> + case 1 ... 6:
> + /* Clear logging flags unsupported for ABI < 7 */
> restrict_flags &= ~(LANDLOCK_RESTRICT_SELF_LOG_SAME_EXEC_OFF |
> LANDLOCK_RESTRICT_SELF_LOG_NEW_EXEC_ON |
> LANDLOCK_RESTRICT_SELF_LOG_SUBDOMAINS_OFF);
> + __attribute__((fallthrough));
> + case 7:
> + /* Removes multithreaded enforcement flag unsupported for ABI < 8 */
> + /*
> + * WARNING!
> + * Don't copy-paste this just yet! This example impacts enforcement
> + * and can potentially decrease protection if misused.
> + *
> + * Below ABI v8, a Landlock policy can only be enforced for the calling
> + * thread and its children. This behavior remains a default for ABI v8,
> + * but the flag ``LANDLOCK_RESTRICT_SELF_TSYNC`` can now be used to
> + * enforce policies across all threads of the calling process. If an
> + * application's Landlock integration was designed under the assumption
> + * that the flag is used (such as when children threads are responsible
> + * for enforcing and/or overriding policies of parents and siblings),
> + * removing said flag can decrease protection for older Linux versions.
> + */
> + restrict_flags &= ~LANDLOCK_RESTRICT_SELF_TSYNC;
> }
Hello!
Sorry for nit-picking even further here;
* You have two immediately adjacent comments here which should be
merged into one.
* It is enough to use a more terse warning here;
would suggest something like:
/*
* Removes multithreaded enforcement flag unsupported for ABI < 8.
*
* WARNING: Calling landlock_restrict_self(2) without this flag
* is only equivalent if the calling process is single-threaded.
*/
Thanks,
–Günther
next prev parent reply other threads:[~2026-03-03 9:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-28 21:36 [PATCH v3] landlock: Expand restrict flags example for ABI version 8 Panagiotis "Ivory" Vasilopoulos
2026-03-03 9:08 ` Günther Noack [this message]
2026-03-03 18:01 ` 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=20260303.13455f40d0c5@gnoack.org \
--to=gnoack3000@gmail.com \
--cc=corbet@lwn.net \
--cc=dan@dcdev.ro \
--cc=git@n0toose.net \
--cc=gnoack@google.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=mic@digikod.net \
--cc=skhan@linuxfoundation.org \
/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.