diff options
author | Kees Cook <keescook@chromium.org> | 2018-09-19 20:48:21 -0400 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2019-01-08 16:18:43 -0500 |
commit | e2bc445b66cad25b0627391df8138a83d0e48f97 (patch) | |
tree | b078f987045e8723a6c9d80049d8c78bbdf2181d /security/security.c | |
parent | d6aed64b74b73b64278c059eacd59d87167aa968 (diff) |
LSM: Introduce enum lsm_order
In preparation for distinguishing the "capability" LSM from other LSMs, it
must be ordered first. This introduces LSM_ORDER_MUTABLE for the general
LSMs and LSM_ORDER_FIRST for capability. In the future LSM_ORDER_LAST
for could be added for anything that must run last (e.g. Landlock may
use this).
Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'security/security.c')
-rw-r--r-- | security/security.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/security/security.c b/security/security.c index 35f93b7c585b..8b673bb2a0dd 100644 --- a/security/security.c +++ b/security/security.c | |||
@@ -174,6 +174,12 @@ static void __init ordered_lsm_parse(const char *order, const char *origin) | |||
174 | struct lsm_info *lsm; | 174 | struct lsm_info *lsm; |
175 | char *sep, *name, *next; | 175 | char *sep, *name, *next; |
176 | 176 | ||
177 | /* LSM_ORDER_FIRST is always first. */ | ||
178 | for (lsm = __start_lsm_info; lsm < __end_lsm_info; lsm++) { | ||
179 | if (lsm->order == LSM_ORDER_FIRST) | ||
180 | append_ordered_lsm(lsm, "first"); | ||
181 | } | ||
182 | |||
177 | /* Process "security=", if given. */ | 183 | /* Process "security=", if given. */ |
178 | if (chosen_major_lsm) { | 184 | if (chosen_major_lsm) { |
179 | struct lsm_info *major; | 185 | struct lsm_info *major; |
@@ -202,7 +208,8 @@ static void __init ordered_lsm_parse(const char *order, const char *origin) | |||
202 | bool found = false; | 208 | bool found = false; |
203 | 209 | ||
204 | for (lsm = __start_lsm_info; lsm < __end_lsm_info; lsm++) { | 210 | for (lsm = __start_lsm_info; lsm < __end_lsm_info; lsm++) { |
205 | if (strcmp(lsm->name, name) == 0) { | 211 | if (lsm->order == LSM_ORDER_MUTABLE && |
212 | strcmp(lsm->name, name) == 0) { | ||
206 | append_ordered_lsm(lsm, origin); | 213 | append_ordered_lsm(lsm, origin); |
207 | found = true; | 214 | found = true; |
208 | } | 215 | } |