Skip to content

Commit ae271c1

Browse files
l0kodJames Morris
authored andcommitted
landlock: Add ruleset and domain management
A Landlock ruleset is mainly a red-black tree with Landlock rules as nodes. This enables quick update and lookup to match a requested access, e.g. to a file. A ruleset is usable through a dedicated file descriptor (cf. following commit implementing syscalls) which enables a process to create and populate a ruleset with new rules. A domain is a ruleset tied to a set of processes. This group of rules defines the security policy enforced on these processes and their future children. A domain can transition to a new domain which is the intersection of all its constraints and those of a ruleset provided by the current process. This modification only impact the current process. This means that a process can only gain more constraints (i.e. lose accesses) over time. Cc: James Morris <jmorris@namei.org> Signed-off-by: Mickaël Salaün <mic@linux.microsoft.com> Acked-by: Serge Hallyn <serge@hallyn.com> Reviewed-by: Kees Cook <keescook@chromium.org> Reviewed-by: Jann Horn <jannh@google.com> Link: https://lore.kernel.org/r/20210422154123.13086-3-mic@digikod.net Signed-off-by: James Morris <jamorris@linux.microsoft.com>
1 parent 9094544 commit ae271c1

File tree

4 files changed

+652
-1
lines changed

4 files changed

+652
-1
lines changed

security/landlock/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
obj-$(CONFIG_SECURITY_LANDLOCK) := landlock.o
22

3-
landlock-y := object.o
3+
landlock-y := object.o ruleset.o

security/landlock/limits.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only */
2+
/*
3+
* Landlock LSM - Limits for different components
4+
*
5+
* Copyright © 2016-2020 Mickaël Salaün <mic@digikod.net>
6+
* Copyright © 2018-2020 ANSSI
7+
*/
8+
9+
#ifndef _SECURITY_LANDLOCK_LIMITS_H
10+
#define _SECURITY_LANDLOCK_LIMITS_H
11+
12+
#include <linux/limits.h>
13+
14+
#define LANDLOCK_MAX_NUM_LAYERS 64
15+
#define LANDLOCK_MAX_NUM_RULES U32_MAX
16+
17+
#endif /* _SECURITY_LANDLOCK_LIMITS_H */

0 commit comments

Comments
 (0)