提交 c3e7843d 编写于 作者: S Stefan Berger 提交者: Yongqiang Liu

ima: Do not print policy rule with inactive LSM labels

mainline inclusion
from mainline-v5.17-rc4
commit 89677197
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I692HU
CVE: NA

--------------------------------

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: 483ec26e ("ima: ima/lsm policy rule loading logic bug fixes")
Signed-off-by: NStefan Berger <stefanb@linux.ibm.com>
Cc: <stable@vger.kernel.org> # v5.6+
Acked-by: NChristian Brauner <brauner@kernel.org>
[zohar@linux.ibm.com: Updated "Fixes" tag]
Signed-off-by: NMimi Zohar <zohar@linux.ibm.com>
Signed-off-by: NGUO Zihua <guozihua@huawei.com>
Reviewed-by: NXiu Jianfeng <xiujianfeng@huawei.com>
Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
上级 c55a3fb2
...@@ -1240,6 +1240,14 @@ int ima_policy_show(struct seq_file *m, void *v) ...@@ -1240,6 +1240,14 @@ int ima_policy_show(struct seq_file *m, void *v)
rcu_read_lock(); 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) if (entry->action & MEASURE)
seq_puts(m, pt(Opt_measure)); seq_puts(m, pt(Opt_measure));
if (entry->action & DONT_MEASURE) if (entry->action & DONT_MEASURE)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册