History

LSM: Identify modules by more than name

Create a struct lsm_id to contain identifying information about Linux Security Modules (LSMs). At inception this contains the name of the module and an identifier associated with the security module. Change the security_add_hooks() interface to use this structure. Change the individual modules to maintain their own struct lsm_id and pass it to security_add_hooks(). The values are for LSM identifiers are defined in a new UAPI header file linux/lsm.h. Each existing LSM has been updated to include it's LSMID in the lsm_id. The LSM ID values are sequential, with the oldest module LSM_ID_CAPABILITY being the lowest value and the existing modules numbered in the order they were included in the main line kernel. This is an arbitrary convention for assigning the values, but none better presents itself. The value 0 is defined as being invalid. The values 1-99 are reserved for any special case uses which may arise in the future. This may include attributes of the LSM infrastructure itself, possibly related to namespacing or network attribute management. A special range is identified for such attributes to help reduce confusion for developers unfamiliar with LSMs. LSM attribute values are defined for the attributes presented by modules that are available today. As with the LSM IDs, The value 0 is defined as being invalid. The values 1-99 are reserved for any special case uses which may arise in the future.

Casey Schaufler committed 3 years ago

Commit f3b87881 parent b85ea9521 files · +162 −22Browse files

Showing the changes to include/uapi (1 of 21 files). Show all

Unified · Split

include/uapi/linux/lsm.h+54−0
@@ -0,0 +1,54 @@
1+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2+/*
3+ * Linux Security Modules (LSM) - User space API
4+ *
5+ * Copyright (C) 2022 Casey Schaufler <casey@schaufler-ca.com>
6+ * Copyright (C) 2022 Intel Corporation
7+ */
8+
9+#ifndef _UAPI_LINUX_LSM_H
10+#define _UAPI_LINUX_LSM_H
11+
12+/*
13+ * ID tokens to identify Linux Security Modules (LSMs)
14+ *
15+ * These token values are used to uniquely identify specific LSMs
16+ * in the kernel as well as in the kernel's LSM userspace API.
17+ *
18+ * A value of zero/0 is considered undefined and should not be used
19+ * outside the kernel. Values 1-99 are reserved for potential
20+ * future use.
21+ */
22+#define LSM_ID_UNDEF 0
23+#define LSM_ID_CAPABILITY 100
24+#define LSM_ID_SELINUX 101
25+#define LSM_ID_SMACK 102
26+#define LSM_ID_TOMOYO 103
27+#define LSM_ID_IMA 104
28+#define LSM_ID_APPARMOR 105
29+#define LSM_ID_YAMA 106
30+#define LSM_ID_LOADPIN 107
31+#define LSM_ID_SAFESETID 108
32+#define LSM_ID_LOCKDOWN 109
33+#define LSM_ID_BPF 110
34+#define LSM_ID_LANDLOCK 111
35+
36+/*
37+ * LSM_ATTR_XXX definitions identify different LSM attributes
38+ * which are used in the kernel's LSM userspace API. Support
39+ * for these attributes vary across the different LSMs. None
40+ * are required.
41+ *
42+ * A value of zero/0 is considered undefined and should not be used
43+ * outside the kernel. Values 1-99 are reserved for potential
44+ * future use.
45+ */
46+#define LSM_ATTR_UNDEF 0
47+#define LSM_ATTR_CURRENT 100
48+#define LSM_ATTR_EXEC 101
49+#define LSM_ATTR_FSCREATE 102
50+#define LSM_ATTR_KEYCREATE 103
51+#define LSM_ATTR_PREV 104
52+#define LSM_ATTR_SOCKCREATE 105
53+
54+#endif /* _UAPI_LINUX_LSM_H */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t