Skip to content

Commit

Permalink
landlock: Add object and rule management
Browse files Browse the repository at this point in the history
A Landlock object enables to identify a kernel object (e.g. an inode).
A Landlock rule is a set of access rights allowed on an object.  Rules
are grouped in rulesets that may be tied to a set of processes (i.e.
subjects) to enforce a scoped access-control (i.e. a domain).

Because Landlock's goal is to empower any process (especially
unprivileged ones) to sandbox themselves, we can't rely on a system-wide
object identification such as file extended attributes.  Indeed, we need
innocuous, composable and modular access-controls.

The main challenge with this constraints is to identify kernel objects
while this identification is useful (i.e. when a security policy makes
use of this object).  But this identification data should be freed once
no policy is using it.  This ephemeral tagging should not and may not be
written in the filesystem.  We then need to manage the lifetime of a
rule according to the lifetime of its object.  To avoid a global lock,
this implementation make use of RCU and counters to safely reference
objects.

A following commit uses this generic object management for inodes.

Signed-off-by: Mickaël Salaün <mic@digikod.net>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: James Morris <jmorris@namei.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Serge E. Hallyn <serge@hallyn.com>
---

Changes since v13:
* New dedicated implementation, removing the need for eBPF.

Previous version:
https://lore.kernel.org/lkml/20190721213116.23476-6-mic@digikod.net/
  • Loading branch information
l0kod committed Feb 24, 2020
1 parent f8788d8 commit 4c85374
Show file tree
Hide file tree
Showing 7 changed files with 504 additions and 0 deletions.
10 changes: 10 additions & 0 deletions MAINTAINERS
Expand Up @@ -9360,6 +9360,16 @@ F: net/core/skmsg.c
F: net/core/sock_map.c
F: net/ipv4/tcp_bpf.c

LANDLOCK SECURITY MODULE
M: Mickaël Salaün <mic@digikod.net>
L: linux-security-module@vger.kernel.org
W: https://landlock.io
T: git https://github.com/landlock-lsm/linux.git
S: Supported
F: security/landlock/
K: landlock
K: LANDLOCK

LANTIQ / INTEL Ethernet drivers
M: Hauke Mehrtens <hauke@hauke-m.de>
L: netdev@vger.kernel.org
Expand Down
1 change: 1 addition & 0 deletions security/Kconfig
Expand Up @@ -238,6 +238,7 @@ source "security/loadpin/Kconfig"
source "security/yama/Kconfig"
source "security/safesetid/Kconfig"
source "security/lockdown/Kconfig"
source "security/landlock/Kconfig"

source "security/integrity/Kconfig"

Expand Down
2 changes: 2 additions & 0 deletions security/Makefile
Expand Up @@ -12,6 +12,7 @@ subdir-$(CONFIG_SECURITY_YAMA) += yama
subdir-$(CONFIG_SECURITY_LOADPIN) += loadpin
subdir-$(CONFIG_SECURITY_SAFESETID) += safesetid
subdir-$(CONFIG_SECURITY_LOCKDOWN_LSM) += lockdown
subdir-$(CONFIG_SECURITY_LANDLOCK) += landlock

# always enable default capabilities
obj-y += commoncap.o
Expand All @@ -29,6 +30,7 @@ obj-$(CONFIG_SECURITY_YAMA) += yama/
obj-$(CONFIG_SECURITY_LOADPIN) += loadpin/
obj-$(CONFIG_SECURITY_SAFESETID) += safesetid/
obj-$(CONFIG_SECURITY_LOCKDOWN_LSM) += lockdown/
obj-$(CONFIG_SECURITY_LANDLOCK) += landlock/
obj-$(CONFIG_CGROUP_DEVICE) += device_cgroup.o

# Object integrity file lists
Expand Down
15 changes: 15 additions & 0 deletions security/landlock/Kconfig
@@ -0,0 +1,15 @@
# SPDX-License-Identifier: GPL-2.0-only

config SECURITY_LANDLOCK
bool "Landlock support"
depends on SECURITY
default n
help
This selects Landlock, a safe sandboxing mechanism. It enables to
restrict processes on the fly (i.e. enforce an access control policy),
which can complement seccomp-bpf. The security policy is a set of access
rights tied to an object, which could be a file, a socket or a process.

See Documentation/security/landlock/ for further information.

If you are unsure how to answer this question, answer N.
3 changes: 3 additions & 0 deletions security/landlock/Makefile
@@ -0,0 +1,3 @@
obj-$(CONFIG_SECURITY_LANDLOCK) := landlock.o

landlock-y := object.o

0 comments on commit 4c85374

Please sign in to comment.