提交 6c24414a 编写于 作者: Z Zhang Tianxing 提交者: Zheng Zengkai

Revert "digest list: disable digest lists in non-root ima namespaces"

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I4O25G
CVE: NA

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

This reverts commit 603cc292.
Signed-off-by: NZhang Tianxing <zhangtianxing3@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
Acked-by: Xiu Jianfeng<xiujianfeng@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 4e0bcf65
...@@ -89,9 +89,6 @@ struct ima_digest *ima_lookup_digest(u8 *digest, enum hash_algo algo, ...@@ -89,9 +89,6 @@ struct ima_digest *ima_lookup_digest(u8 *digest, enum hash_algo algo,
int digest_len = hash_digest_size[algo]; int digest_len = hash_digest_size[algo];
unsigned int key = ima_hash_key(digest); unsigned int key = ima_hash_key(digest);
if (&init_ima_ns != get_current_ns())
return NULL;
rcu_read_lock(); rcu_read_lock();
hlist_for_each_entry_rcu(d, &ima_digests_htable.queue[key], hnext) hlist_for_each_entry_rcu(d, &ima_digests_htable.queue[key], hnext)
if (d->algo == algo && d->type == type && if (d->algo == algo && d->type == type &&
...@@ -176,9 +173,6 @@ int ima_parse_compact_list(loff_t size, void *buf, int op) ...@@ -176,9 +173,6 @@ int ima_parse_compact_list(loff_t size, void *buf, int op)
size_t digest_len; size_t digest_len;
int ret = 0, i; int ret = 0, i;
if (&init_ima_ns != get_current_ns())
return -EACCES;
if (!(ima_digest_list_actions & init_policy_data.ima_policy_flag)) if (!(ima_digest_list_actions & init_policy_data.ima_policy_flag))
return -EACCES; return -EACCES;
...@@ -251,9 +245,6 @@ void ima_check_measured_appraised(struct file *file) ...@@ -251,9 +245,6 @@ void ima_check_measured_appraised(struct file *file)
{ {
struct integrity_iint_cache *iint; struct integrity_iint_cache *iint;
if (&init_ima_ns != get_current_ns())
return;
if (!ima_digest_list_actions) if (!ima_digest_list_actions)
return; return;
...@@ -290,9 +281,6 @@ void ima_check_measured_appraised(struct file *file) ...@@ -290,9 +281,6 @@ void ima_check_measured_appraised(struct file *file)
struct ima_digest *ima_digest_allow(struct ima_digest *digest, int action) struct ima_digest *ima_digest_allow(struct ima_digest *digest, int action)
{ {
if (&init_ima_ns != get_current_ns())
return NULL;
if (!(ima_digest_list_actions & action)) if (!(ima_digest_list_actions & action))
return NULL; return NULL;
......
...@@ -60,17 +60,11 @@ static int valid_policy = 1; ...@@ -60,17 +60,11 @@ static int valid_policy = 1;
static int ima_open_simple(struct inode *inode, struct file *file) static int ima_open_simple(struct inode *inode, struct file *file)
{ {
struct dentry *dentry = file_dentry(file);
struct ima_namespace *ima_ns = get_current_ns(); struct ima_namespace *ima_ns = get_current_ns();
if (!ns_capable(ima_ns->user_ns, CAP_SYS_ADMIN)) if (!ns_capable(ima_ns->user_ns, CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
if (dentry == digests_count) {
if (&init_ima_ns != get_current_ns())
return -EACCES;
}
return 0; return 0;
} }
...@@ -562,12 +556,9 @@ static int ima_open_data_upload(struct inode *inode, struct file *filp) ...@@ -562,12 +556,9 @@ static int ima_open_data_upload(struct inode *inode, struct file *filp)
if (test_and_set_bit(flag, &ima_fs_flags)) if (test_and_set_bit(flag, &ima_fs_flags))
return -EBUSY; return -EBUSY;
if (dentry == digest_list_data || dentry == digest_list_data_del) { if (dentry == digest_list_data || dentry == digest_list_data_del)
if (&init_ima_ns != get_current_ns())
return -EACCES;
if (ima_check_current_is_parser()) if (ima_check_current_is_parser())
ima_set_parser(); ima_set_parser();
}
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册