[PATCH] landlock: Clarify namespace and capability permission boundaries

sashiko-bot at kernel.org sashiko-bot at kernel.org
Tue Dec 1 19:43:35 UTC 2026


Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] landlock: incomplete update of namespace fd-reference wording in
  docs
--

commit b0c0c94c5196be874090a6228b828116a0227e60
Author: Mickaël Salaün <mic at digikod.net>

landlock: Clarify namespace and capability permission boundaries

This commit rewords the capability and namespace restrictions section in
Documentation/userspace-api/landlock.rst to clarify that
LANDLOCK_PERMISSION_NAMESPACE_USE covers namespace creation and
reassociation rather than opening existing namespaces, and describes
capability exercise as an independent check.

Link: https://patch.msgid.link/179566442733.1993761.8053687674090289362@163.com [1]

> diff --git a/Documentation/userspace-api/landlock.rst b/Documentation/userspace-api/landlock.rst
> index 7cc5fde482623..1748267930408 100644
> --- a/Documentation/userspace-api/landlock.rst
> +++ b/Documentation/userspace-api/landlock.rst

[ ... ]

> @@ -525,25 +525,23 @@ rights (``handled_access_*``) or cross-domain scopes (``scoped``), per-category
>  permissions constrain the sandboxed process's own use of these enums; members
>  not allowed by a rule are denied by default.
>  
> -``LANDLOCK_PERMISSION_NAMESPACE_USE`` gates *acquisition of access* to
> -namespaces: creation via :manpage:`unshare(2)` / :manpage:`clone(2)`
> -/ :manpage:`clone3(2)`, entry via :manpage:`setns(2)`, and fd-reference
> -acquisition via :manpage:`open_tree(2)` / :manpage:`fsmount(2)`.  Namespaces
> -the process is already a member of when the domain is enforced are implicitly
> -allowed (the process could not continue running otherwise); rules describe
> -which new namespace types the process may acquire.
> +``LANDLOCK_PERMISSION_NAMESPACE_USE`` restricts which namespace types a
> +process may create or reassociate with.  It covers creation even when the
> +caller does not join the new namespace, but does not restrict opening an
> +existing namespace.  Enforcing this permission does not revoke existing
> +namespace membership.

[Severity: Low]
Should the other occurrences of the "fd-reference acquisition" phrasing in
this document and in the UAPI header kernel-doc (which is included into
this guide) be updated to match?

In Documentation/userspace-api/landlock.rst under "Creating a new ruleset":

  For namespace access-control, we can add rules that allow using specific
  namespace types (see :manpage:`namespaces(7)` for the list of ``CLONE_NEW*``
  values): creating them via :manpage:`unshare(2)` / :manpage:`clone(2)` /
  :manpage:`clone3(2)`, joining them via :manpage:`setns(2)`, or acquiring an fd
  reference via :manpage:`open_tree(2)` / :manpage:`fsmount(2)`.

In Documentation/userspace-api/landlock.rst under "Namespace (ABI < 12)":

  Starting with the Landlock ABI version 12, it is possible to restrict namespace
  use (see :manpage:`namespaces(7)`) across creation (:manpage:`unshare(2)`,
  :manpage:`clone(2)`, :manpage:`clone3(2)`), entry (:manpage:`setns(2)`), and
  fd-reference acquisition (:manpage:`open_tree(2)`, :manpage:`fsmount(2)`) with
  the new ``LANDLOCK_PERMISSION_NAMESPACE_USE`` permission flag and
  ``LANDLOCK_RULE_NAMESPACE`` rule type.

And in include/uapi/linux/landlock.h:

   * - %LANDLOCK_PERMISSION_NAMESPACE_USE: Restrict the use of specific namespace
   *   types: creation (:manpage:`unshare(2)`, :manpage:`clone(2)`,
   *   :manpage:`clone3(2)`), joining (:manpage:`setns(2)`), and acquiring an fd
   *   reference (:manpage:`open_tree(2)`, :manpage:`fsmount(2)`).

Leaving those three passages unchanged keeps the old distinction between
creation and fd-reference acquisition in the same rendered userspace API
guide.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261201193814.760891-1-mic@digikod.net?part=1



More information about the Linux-security-module-archive mailing list