提交 614857d3 编写于 作者: L Li Kun 提交者: Zheng Zengkai

ima: Fix the pathname to relative path when get absolute path failed

euler inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I4L078
CVE: NA

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

We backport the
commit 17f4bad3 ("ima: remove usage of filename parameter") to
support absolute path in ima measurement log,when get absolute path
failed, the pathname with NULL value will be passed to the next
measurement processes. Fix the pathname to relative path when get
absolute path failed.
Signed-off-by: NLi Kun <hw.likun@huawei.com>
Signed-off-by: NKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: NHui Wang <john.wanghui@huawei.com>
Signed-off-by: NZhang Xiaoxu <zhangxiaoxu5@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Reviewed-by: NJason Yan <yanaijie@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>

Conflicts:
	security/integrity/ima/ima_main.c
Signed-off-by: NGuo Zihua <guozihua@huawei.com>
Reviewed-by: NXiu Jianfeng <xiujianfeng@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 8ba9f7a0
...@@ -502,6 +502,9 @@ static int process_ns_measurement(struct file *file, const struct cred *cred, ...@@ -502,6 +502,9 @@ static int process_ns_measurement(struct file *file, const struct cred *cred,
if (!pathbuf) /* ima_rdwr_violation possibly pre-fetched */ if (!pathbuf) /* ima_rdwr_violation possibly pre-fetched */
pathname = ima_d_path(&file->f_path, &pathbuf, filename); pathname = ima_d_path(&file->f_path, &pathbuf, filename);
if (!pathname || strlen(pathname) > IMA_EVENT_NAME_LEN_MAX)
pathname = file->f_path.dentry->d_name.name;
found_digest = ima_lookup_digest(iint->ima_hash->digest, hash_algo, found_digest = ima_lookup_digest(iint->ima_hash->digest, hash_algo,
COMPACT_FILE); COMPACT_FILE);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册