]> git.baikalelectronics.ru Git - kernel.git/commit
ima: ima/lsm policy rule loading logic bug fixes
authorJanne Karhunen <janne.karhunen@gmail.com>
Wed, 15 Jan 2020 15:42:30 +0000 (17:42 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Mar 2020 15:43:49 +0000 (16:43 +0100)
commita2d772a4d3d190bfeb0b2faa3687027746453d74
tree86c173e24c0f7524dc311bd100a5f3f1b00dfab7
parent41f2f2c3634c6ef8cd6424e172c98b3d6a55189f
ima: ima/lsm policy rule loading logic bug fixes

commit 26c1c2fa68738588165c68635dbbb0874b107686 upstream.

Keep the ima policy rules around from the beginning even if they appear
invalid at the time of loading, as they may become active after an lsm
policy load.  However, loading a custom IMA policy with unknown LSM
labels is only safe after we have transitioned from the "built-in"
policy rules to a custom IMA policy.

Patch also fixes the rule re-use during the lsm policy reload and makes
some prints a bit more human readable.

Changelog:
v4:
- Do not allow the initial policy load refer to non-existing lsm rules.
v3:
- Fix too wide policy rule matching for non-initialized LSMs
v2:
- Fix log prints

Fixes: 040c9d4f2e03 ("ima: use the lsm policy update notifier")
Cc: Casey Schaufler <casey@schaufler-ca.com>
Reported-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: Janne Karhunen <janne.karhunen@gmail.com>
Signed-off-by: Konsta Karsisto <konsta.karsisto@gmail.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
security/integrity/ima/ima_policy.c