Skip to content

Commit 8967719

Browse files
stefanbergermimizohar
authored andcommitted
ima: Do not print policy rule with inactive LSM labels
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 <stefanb@linux.ibm.com> Cc: <stable@vger.kernel.org> # v5.6+ Acked-by: Christian Brauner <brauner@kernel.org> [zohar@linux.ibm.com: Updated "Fixes" tag] Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
1 parent bb8e52e commit 8967719

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

security/integrity/ima/ima_policy.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1967,6 +1967,14 @@ int ima_policy_show(struct seq_file *m, void *v)
19671967

19681968
rcu_read_lock();
19691969

1970+
/* Do not print rules with inactive LSM labels */
1971+
for (i = 0; i < MAX_LSM_RULES; i++) {
1972+
if (entry->lsm[i].args_p && !entry->lsm[i].rule) {
1973+
rcu_read_unlock();
1974+
return 0;
1975+
}
1976+
}
1977+
19701978
if (entry->action & MEASURE)
19711979
seq_puts(m, pt(Opt_measure));
19721980
if (entry->action & DONT_MEASURE)

0 commit comments

Comments
 (0)