Skip to content

Commit

Permalink
ima: Do not print policy rule with inactive LSM labels
Browse files Browse the repository at this point in the history
Before printing a policy rule scan for inactive LSM labels in the policy
rule. Inactive LSM labels are identified by args_p != NULL and
rule == NULL.

Fixes: 483ec26 ("ima: ima/lsm policy rule loading logic bug fixes")
Signed-off-by: Stefan Berger <[email protected]>
Cc: <[email protected]> # v5.6+
Acked-by: Christian Brauner <[email protected]>
[[email protected]: Updated "Fixes" tag]
Signed-off-by: Mimi Zohar <[email protected]>
  • Loading branch information
stefanberger authored and mimizohar committed Feb 2, 2022
1 parent bb8e52e commit 8967719
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions security/integrity/ima/ima_policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -1967,6 +1967,14 @@ int ima_policy_show(struct seq_file *m, void *v)

rcu_read_lock();

/* Do not print rules with inactive LSM labels */
for (i = 0; i < MAX_LSM_RULES; i++) {
if (entry->lsm[i].args_p && !entry->lsm[i].rule) {
rcu_read_unlock();
return 0;
}
}

if (entry->action & MEASURE)
seq_puts(m, pt(Opt_measure));
if (entry->action & DONT_MEASURE)
Expand Down

0 comments on commit 8967719

Please sign in to comment.