Skip to content

Commit b59fda4

Browse files
kstruczymimizohar
authored andcommitted
ima: Set again build_ima_appraise variable
After adding the new add_rule() function in commit c52657d ("ima: refactor ima_init_policy()"), all appraisal flags are added to the temp_ima_appraise variable. Revert to the previous behavior instead of removing build_ima_appraise, to benefit from the protection offered by __ro_after_init. The mentioned commit introduced a bug, as it makes all the flags modifiable, while build_ima_appraise flags can be protected with __ro_after_init. Cc: [email protected] # 5.0.x Fixes: c52657d ("ima: refactor ima_init_policy()") Co-developed-by: Roberto Sassu <[email protected]> Signed-off-by: Roberto Sassu <[email protected]> Signed-off-by: Krzysztof Struczynski <[email protected]> Signed-off-by: Mimi Zohar <[email protected]>
1 parent 6ee2844 commit b59fda4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

security/integrity/ima/ima_policy.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -643,8 +643,14 @@ static void add_rules(struct ima_rule_entry *entries, int count,
643643

644644
list_add_tail(&entry->list, &ima_policy_rules);
645645
}
646-
if (entries[i].action == APPRAISE)
647-
temp_ima_appraise |= ima_appraise_flag(entries[i].func);
646+
if (entries[i].action == APPRAISE) {
647+
if (entries != build_appraise_rules)
648+
temp_ima_appraise |=
649+
ima_appraise_flag(entries[i].func);
650+
else
651+
build_ima_appraise |=
652+
ima_appraise_flag(entries[i].func);
653+
}
648654
}
649655
}
650656

0 commit comments

Comments
 (0)