From 501f1bde66525f94403a5b78832a9218ef9b1c14 Mon Sep 17 00:00:00 2001 From: Mimi Zohar Date: Tue, 10 Nov 2015 09:00:38 -0500 Subject: [PATCH] IMA: prevent keys on the .ima_blacklist from being removed Set the KEY_FLAGS_KEEP on the .ima_blacklist to prevent userspace from removing keys from the keyring. Signed-off-by: Mimi Zohar --- security/integrity/ima/ima_mok.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/security/integrity/ima/ima_mok.c b/security/integrity/ima/ima_mok.c index 18e37f5..8dad9a2 100644 --- a/security/integrity/ima/ima_mok.c +++ b/security/integrity/ima/ima_mok.c @@ -47,7 +47,9 @@ __init int ima_mok_init(void) if (IS_ERR(ima_mok_keyring) || IS_ERR(ima_blacklist_keyring)) panic("Can't allocate IMA MOK or blacklist keyrings."); set_bit(KEY_FLAG_TRUSTED_ONLY, &ima_mok_keyring->flags); + set_bit(KEY_FLAG_TRUSTED_ONLY, &ima_blacklist_keyring->flags); + set_bit(KEY_FLAG_KEEP, &ima_blacklist_keyring->flags); return 0; } -- 2.7.4