Skip to content

Commit eb624fe

Browse files
tyhicksmimizohar
authored andcommitted
ima: Fail rule parsing when the KEY_CHECK hook is combined with an invalid cond
The KEY_CHECK function only supports the uid, pcr, and keyrings conditionals. Make this clear at policy load so that IMA policy authors don't assume that other conditionals are supported. Fixes: 5808611 ("IMA: Add KEY_CHECK func to measure keys") Signed-off-by: Tyler Hicks <tyhicks@linux.microsoft.com> Reviewed-by: Lakshmi Ramasubramanian <nramas@linux.microsoft.com> Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
1 parent db2045f commit eb624fe

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

security/integrity/ima/ima_policy.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,6 +1023,13 @@ static bool ima_validate_rule(struct ima_rule_entry *entry)
10231023
if (entry->action & ~(MEASURE | DONT_MEASURE))
10241024
return false;
10251025

1026+
if (entry->flags & ~(IMA_FUNC | IMA_UID | IMA_PCR |
1027+
IMA_KEYRINGS))
1028+
return false;
1029+
1030+
if (ima_rule_contains_lsm_cond(entry))
1031+
return false;
1032+
10261033
break;
10271034
default:
10281035
return false;

0 commit comments

Comments
 (0)