1 /* SPDX-License-Identifier: GPL-2.0 */
4 * Copyright (C) 2023 Google LLC.
7 #ifndef __LINUX_LSM_COUNT_H
8 #define __LINUX_LSM_COUNT_H
10 #include <linux/args.h>
12 #ifdef CONFIG_SECURITY
15 * Macros to count the number of LSMs enabled in the kernel at compile time.
19 * Capabilities is enabled when CONFIG_SECURITY is enabled.
21 #if IS_ENABLED(CONFIG_SECURITY)
22 #define CAPABILITIES_ENABLED 1,
24 #define CAPABILITIES_ENABLED
27 #if IS_ENABLED(CONFIG_SECURITY_SELINUX)
28 #define SELINUX_ENABLED 1,
30 #define SELINUX_ENABLED
33 #if IS_ENABLED(CONFIG_SECURITY_SMACK)
34 #define SMACK_ENABLED 1,
39 #if IS_ENABLED(CONFIG_SECURITY_APPARMOR)
40 #define APPARMOR_ENABLED 1,
42 #define APPARMOR_ENABLED
45 #if IS_ENABLED(CONFIG_SECURITY_TOMOYO)
46 #define TOMOYO_ENABLED 1,
48 #define TOMOYO_ENABLED
51 #if IS_ENABLED(CONFIG_SECURITY_YAMA)
52 #define YAMA_ENABLED 1,
57 #if IS_ENABLED(CONFIG_SECURITY_LOADPIN)
58 #define LOADPIN_ENABLED 1,
60 #define LOADPIN_ENABLED
63 #if IS_ENABLED(CONFIG_SECURITY_LOCKDOWN_LSM)
64 #define LOCKDOWN_ENABLED 1,
66 #define LOCKDOWN_ENABLED
69 #if IS_ENABLED(CONFIG_SECURITY_SAFESETID)
70 #define SAFESETID_ENABLED 1,
72 #define SAFESETID_ENABLED
75 #if IS_ENABLED(CONFIG_BPF_LSM)
76 #define BPF_LSM_ENABLED 1,
78 #define BPF_LSM_ENABLED
81 #if IS_ENABLED(CONFIG_SECURITY_LANDLOCK)
82 #define LANDLOCK_ENABLED 1,
84 #define LANDLOCK_ENABLED
87 #if IS_ENABLED(CONFIG_IMA)
88 #define IMA_ENABLED 1,
93 #if IS_ENABLED(CONFIG_EVM)
94 #define EVM_ENABLED 1,
99 #if IS_ENABLED(CONFIG_SECURITY_IPE)
100 #define IPE_ENABLED 1,
106 * There is a trailing comma that we need to be accounted for. This is done by
107 * using a skipped argument in __COUNT_LSMS
109 #define __COUNT_LSMS(skipped_arg, args...) COUNT_ARGS(args...)
110 #define COUNT_LSMS(args...) __COUNT_LSMS(args)
112 #define MAX_LSM_COUNT \
114 CAPABILITIES_ENABLED \
131 #define MAX_LSM_COUNT 0
133 #endif /* CONFIG_SECURITY */
135 #endif /* __LINUX_LSM_COUNT_H */