Linux Security Modules development
 help / color / mirror / Atom feed
From: "Günther Noack" <gnoack@google.com>
To: "Mickaël Salaün" <mic@digikod.net>
Cc: Ada Smith <adasmithgt@gmail.com>,
	Hungyu Lin <dennylin0707@gmail.com>,
	James Morris <jmorris@namei.org>,
	Josef Bacik <josef@toxicpanda.com>,
	Paul Moore <paul@paul-moore.com>, Serge Hallyn <serge@hallyn.com>,
	Serge Hallyn <sergeh@kernel.org>,
	kernel-team@cloudflare.com, linux-kernel@vger.kernel.org,
	linux-security-module@vger.kernel.org
Subject: Re: [PATCH v2 6/6] landlock: Fix capability restriction documentation
Date: Tue, 17 Nov 2026 17:25:07 +0100	[thread overview]
Message-ID: <avx_49eHcDPjyuDU@google.com> (raw)
In-Reply-To: <20261117101157.2520463-7-mic@digikod.net>

On Tue, Nov 17, 2026 at 11:11:56AM +0100, Mickaël Salaün wrote:
> Some documented claims about LANDLOCK_PERMISSION_CAPABILITY_USE do not
> hold for every capability check.  Remove them instead of listing their
> exceptions, and call it a permission instead of a hook.
> 
> Cc: Günther Noack <gnoack@google.com>
> Cc: Paul Moore <paul@paul-moore.com>
> Cc: Serge Hallyn <serge@hallyn.com>
> Acked-by: Serge Hallyn (AMD) <sergeh@kernel.org>
> Fixes: 97c8386f1d74 ("landlock: Enforce capability restrictions")
> Signed-off-by: Mickaël Salaün <mic@digikod.net>
> ---
> 
> Changes since v1:
> https://patch.msgid.link/20261110202436.2408244-7-mic@digikod.net
> - Add Serge Hallyn's Acked-by.
> ---
>  Documentation/security/landlock.rst      | 8 ++++----
>  Documentation/userspace-api/landlock.rst | 8 ++++----
>  include/uapi/linux/landlock.h            | 6 +++---
>  3 files changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/Documentation/security/landlock.rst b/Documentation/security/landlock.rst
> index d81f1c2cd236..98c2e7139e8d 100644
> --- a/Documentation/security/landlock.rst
> +++ b/Documentation/security/landlock.rst
> @@ -8,7 +8,7 @@ Landlock LSM: kernel documentation
>  ==================================
>  
>  :Author: Mickaël Salaün
> -:Date: October 2026
> +:Date: November 2026
>  
>  Landlock's goal is to create scoped access-control (i.e. sandboxing).  To
>  harden a whole system, this feature should be available to any process,
> @@ -359,9 +359,9 @@ framework in ``log.c``, compiled under ``CONFIG_SECURITY_LANDLOCK_LOG``
>  (automatically selected by ``CONFIG_AUDIT`` or ``CONFIG_TRACEPOINTS``).
>  
>  Audit records respect audit configuration, the domain's Landlock log
> -flags, and ``LANDLOCK_LOG_DISABLED``.  Tracepoints fire unconditionally,
> -independent of these settings.  The denial counter (``num_denials``) is
> -always incremented regardless of logging configuration.
> +flags, and ``LANDLOCK_LOG_DISABLED``.  Tracepoints fire independently of
> +these settings.  The denial counter (``num_denials``) is
> +incremented regardless of logging configuration.
>  
>  Each denial tracepoint carries a ``logged`` field reporting the
>  audit-logging verdict: whether the denial would be written to the audit
> diff --git a/Documentation/userspace-api/landlock.rst b/Documentation/userspace-api/landlock.rst
> index 3d45b956b640..d00e94d8ed37 100644
> --- a/Documentation/userspace-api/landlock.rst
> +++ b/Documentation/userspace-api/landlock.rst
> @@ -8,7 +8,7 @@ Landlock: unprivileged access control
>  =====================================
>  
>  :Author: Mickaël Salaün
> -:Date: October 2026
> +:Date: November 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
> @@ -532,7 +532,7 @@ 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_CAPABILITY_USE`` gates every exercise of a capability
> +``LANDLOCK_PERMISSION_CAPABILITY_USE`` gates the exercise of capabilities
>  after the domain is enforced, regardless
>  of how the capability was obtained (inherited credentials, ``CLONE_NEWUSER``
>  grant, ``setuid``/file-cap-bearing :manpage:`execve(2)`, etc.).  Configuring
> @@ -641,9 +641,9 @@ after a domain is enforced through user namespace entry or :manpage:`capset(2)`;
>  privileged sandboxes that did not set ``PR_SET_NO_NEW_PRIVS`` may also gain
>  capabilities through :manpage:`execve(2)` of binaries with file capabilities.
>  In all cases, :manpage:`capget(2)` will report the credential's capability sets,
> -but any denied capability will fail with ``EPERM`` when exercised.  Do not rely
> +but any denied capability will fail when exercised.  Do not rely
>  on :manpage:`capget(2)` to determine whether the policy permits a given
> -capability; only the actual operation will return ``EPERM`` upon denial.
> +capability.
>  
>  Truncating files
>  ----------------
> diff --git a/include/uapi/linux/landlock.h b/include/uapi/linux/landlock.h
> index 24510e5d8479..c9e4ce23778b 100644
> --- a/include/uapi/linux/landlock.h
> +++ b/include/uapi/linux/landlock.h
> @@ -622,9 +622,9 @@ struct landlock_capability_attr {
>   * - %LANDLOCK_PERMISSION_CAPABILITY_USE: Restrict the use of specific Linux
>   *   capabilities.  A process in a Landlock domain that handles this permission
>   *   is denied from exercising capabilities that are not explicitly allowed by a
> - *   %LANDLOCK_RULE_CAPABILITY rule.  This hook is purely restrictive: it can
> - *   deny capabilities that the kernel would otherwise grant, but it can never
> - *   grant capabilities that the kernel already denied.  Support added in
> + *   %LANDLOCK_RULE_CAPABILITY rule.  This permission is purely restrictive: it

"The permission is purely restrictive"... that sounds like an
oxymoron, similar for "[The permission] can deny capabilities..." in
the sentence below.

It is not complicated though; How about just shortening the sentences
"This hook is purely restrictive: it can deny ..., but it can never
grant capabilities that the kernel already denied" down to

  Landlock only reduces the capabilities that processes can use.  It
  does not let processes use capabilities that they don't already have
  without Landlock.

?

> + *   can deny capabilities that the kernel would otherwise grant, but it can
> + *   never grant capabilities that the kernel already denied.  Support added in
>   *   Landlock ABI version 12.
>   */
>  #define LANDLOCK_PERMISSION_NAMESPACE_USE			(1ULL << 0)
> -- 
> 2.56.0
> 

Reviewed-by: Günther Noack <gnoack@google.com>

      parent reply	other threads:[~2026-11-17 16:25 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 10:11 [PATCH v2 0/6] Fix Landlock mediation of commoncap's capability checks Mickaël Salaün
2026-11-17 10:11 ` [PATCH v2 1/6] landlock: Factor out capability denial checks Mickaël Salaün
2026-11-17 10:14   ` sashiko-bot
2026-11-17 13:56   ` Günther Noack
2026-11-17 10:11 ` [PATCH v2 2/6] landlock: Mediate CAP_SYS_RAWIO for mappings below mmap_min_addr Mickaël Salaün
2026-11-17 10:18   ` sashiko-bot
2026-11-17 14:23   ` Günther Noack
2026-11-17 10:11 ` [PATCH v2 3/6] landlock: Mediate CAP_SETPCAP for inheritable capabilities Mickaël Salaün
2026-11-17 10:17   ` sashiko-bot
2026-11-17 15:41   ` Günther Noack
2026-11-17 10:11 ` [PATCH v2 4/6] landlock: Mediate CAP_SYS_ADMIN for the admin memory reserve Mickaël Salaün
2026-11-17 10:16   ` sashiko-bot
2026-11-17 15:43   ` Günther Noack
2026-11-17 10:11 ` [PATCH v2 5/6] selftests/landlock: Test capability checks outside the capable hook Mickaël Salaün
2026-11-17 10:20   ` sashiko-bot
2026-11-17 16:11   ` Günther Noack
2026-11-17 10:11 ` [PATCH v2 6/6] landlock: Fix capability restriction documentation Mickaël Salaün
2026-11-17 10:17   ` sashiko-bot
2026-11-17 16:25   ` Günther Noack [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=avx_49eHcDPjyuDU@google.com \
    --to=gnoack@google.com \
    --cc=adasmithgt@gmail.com \
    --cc=dennylin0707@gmail.com \
    --cc=jmorris@namei.org \
    --cc=josef@toxicpanda.com \
    --cc=kernel-team@cloudflare.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=mic@digikod.net \
    --cc=paul@paul-moore.com \
    --cc=serge@hallyn.com \
    --cc=sergeh@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox