]> www.infradead.org Git - users/jedix/linux-maple.git/commit
landlock: Add syscall implementations
authorMickaël Salaün <mic@linux.microsoft.com>
Wed, 7 Apr 2021 16:07:22 +0000 (18:07 +0200)
committerJames Morris <jamorris@linux.microsoft.com>
Fri, 9 Apr 2021 01:37:59 +0000 (18:37 -0700)
commit276f3a79632da432b58591b22a2a3d400ee9ca12
treee03775cd39795996db0a697c49cd4483ca716555
parent9aeff19745cac7871e11135f4dbae34e239e9686
landlock: Add syscall implementations

These 3 system calls are designed to be used by unprivileged processes
to sandbox themselves:
* landlock_create_ruleset(2): Creates a ruleset and returns its file
  descriptor.
* landlock_add_rule(2): Adds a rule (e.g. file hierarchy access) to a
  ruleset, identified by the dedicated file descriptor.
* landlock_restrict_self(2): Enforces a ruleset on the calling thread
  and its future children (similar to seccomp).  This syscall has the
  same usage restrictions as seccomp(2): the caller must have the
  no_new_privs attribute set or have CAP_SYS_ADMIN in the current user
  namespace.

All these syscalls have a "flags" argument (not currently used) to
enable extensibility.

Here are the motivations for these new syscalls:
* A sandboxed process may not have access to file systems, including
  /dev, /sys or /proc, but it should still be able to add more
  restrictions to itself.
* Neither prctl(2) nor seccomp(2) (which was used in a previous version)
  fit well with the current definition of a Landlock security policy.

All passed structs (attributes) are checked at build time to ensure that
they don't contain holes and that they are aligned the same way for each
architecture.

See the user and kernel documentation for more details (provided by a
following commit):
* Documentation/userspace-api/landlock.rst
* Documentation/security/landlock.rst

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: James Morris <jmorris@namei.org>
Cc: Jann Horn <jannh@google.com>
Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Mickaël Salaün <mic@linux.microsoft.com>
Acked-by: Serge Hallyn <serge@hallyn.com>
Link: https://lore.kernel.org/r/20210407160726.542794-9-mic@digikod.net
Signed-off-by: James Morris <jamorris@linux.microsoft.com>
include/linux/syscalls.h
include/uapi/linux/landlock.h
kernel/sys_ni.c
security/landlock/Makefile
security/landlock/syscalls.c [new file with mode: 0644]