Re: [PATCH v21 12/12] landlock: Add user and kernel documentation

From: Mickaël Salaün
Date: Thu Oct 15 2020 - 08:32:09 EST



On 08/10/2020 17:31, Mickaël Salaün wrote:
> From: Mickaël Salaün <mic@xxxxxxxxxxxxxxxxxxx>
>
> This documentation can be built with the Sphinx framework.
>
> Cc: James Morris <jmorris@xxxxxxxxx>
> Cc: Jann Horn <jannh@xxxxxxxxxx>
> Cc: Kees Cook <keescook@xxxxxxxxxxxx>
> Cc: Serge E. Hallyn <serge@xxxxxxxxxx>
> Signed-off-by: Mickaël Salaün <mic@xxxxxxxxxxxxxxxxxxx>
> Reviewed-by: Vincent Dagonneau <vincent.dagonneau@xxxxxxxxxxx>
> ---
>
> Changes since v20:
> * Update examples and documentation with the new syscalls.
>
> Changes since v19:
> * Update examples and documentation with the new syscalls.
>
> Changes since v15:
> * Add current limitations.
>
> Changes since v14:
> * Fix spelling (contributed by Randy Dunlap).
> * Extend documentation about inheritance and explain layer levels.
> * Remove the use of now-removed access rights.
> * Use GitHub links.
> * Improve kernel documentation.
> * Add section for tests.
> * Update example.
>
> Changes since v13:
> * Rewrote the documentation according to the major revamp.
>
> Previous changes:
> https://lore.kernel.org/lkml/20191104172146.30797-8-mic@xxxxxxxxxxx/
> ---
> Documentation/security/index.rst | 1 +
> Documentation/security/landlock/index.rst | 18 ++
> Documentation/security/landlock/kernel.rst | 69 ++++++
> Documentation/security/landlock/user.rst | 242 +++++++++++++++++++++
> 4 files changed, 330 insertions(+)
> create mode 100644 Documentation/security/landlock/index.rst
> create mode 100644 Documentation/security/landlock/kernel.rst
> create mode 100644 Documentation/security/landlock/user.rst
>
> diff --git a/Documentation/security/index.rst b/Documentation/security/index.rst
> index 8129405eb2cc..e3f2bf4fef77 100644
> --- a/Documentation/security/index.rst
> +++ b/Documentation/security/index.rst
> @@ -16,3 +16,4 @@ Security Documentation
> siphash
> tpm/index
> digsig
> + landlock/index
> diff --git a/Documentation/security/landlock/index.rst b/Documentation/security/landlock/index.rst
> new file mode 100644
> index 000000000000..2520f8f33f5e
> --- /dev/null
> +++ b/Documentation/security/landlock/index.rst
> @@ -0,0 +1,18 @@
> +=========================================
> +Landlock LSM: unprivileged access control
> +=========================================
> +
> +:Author: Mickaël Salaün
> +
> +The goal of Landlock is to enable to restrict ambient rights (e.g. global
> +filesystem access) for a set of processes. Because Landlock is a stackable
> +LSM, it makes possible to create safe security sandboxes as new security layers
> +in addition to the existing system-wide access-controls. This kind of sandbox
> +is expected to help mitigate the security impact of bugs or
> +unexpected/malicious behaviors in user-space applications. Landlock empowers
> +any process, including unprivileged ones, to securely restrict themselves.
> +
> +.. toctree::
> +
> + user
> + kernel
> diff --git a/Documentation/security/landlock/kernel.rst b/Documentation/security/landlock/kernel.rst
> new file mode 100644
> index 000000000000..27c0933a0b6e
> --- /dev/null
> +++ b/Documentation/security/landlock/kernel.rst
> @@ -0,0 +1,69 @@
> +==============================
> +Landlock: kernel documentation
> +==============================
Cf. https://landlock.io/linux-doc/landlock-v21/security/landlock/kernel.html

I guess this is the good place for kernel API documentation.

> diff --git a/Documentation/security/landlock/user.rst b/Documentation/security/landlock/user.rst
> new file mode 100644
> index 000000000000..e6fbc75c1af1
> --- /dev/null
> +++ b/Documentation/security/landlock/user.rst
> @@ -0,0 +1,242 @@
> +=================================
> +Landlock: userspace documentation
> +=================================
Cf. https://landlock.io/linux-doc/landlock-v21/security/landlock/user.html

Shouldn't this go in Documentation/userspace-api/ instead?

Documentation/security/lsm-development.rst says that LSM documentation
should go to Documentation/admin-guide/LSM/ but this is not (like
seccomp) an admin documentation.
Should the Documentation/userspace-api/landlock.rst be linked from
Documentation/admin-guide/LSM/index.rst too?