提交 04288f42 编写于 作者: M Mimi Zohar 提交者: James Morris

integrity: ima audit dentry_open failure

Until we start appraising measurements, the ima_path_check()
return code should always be 0.

- Update the ima_path_check() return code comment
- Instead of the pr_info, audit the dentry_open failure
Signed-off-by: NMimi Zohar <zohar@us.ibm.com>
Acked-by: NEric Paris <eparis@redhat.com>
Signed-off-by: NJames Morris <jmorris@namei.org>
上级 bcb86975
...@@ -149,8 +149,8 @@ static void ima_update_counts(struct ima_iint_cache *iint, int mask) ...@@ -149,8 +149,8 @@ static void ima_update_counts(struct ima_iint_cache *iint, int mask)
* - Opening a file for read when already open for write, * - Opening a file for read when already open for write,
* could result in a file measurement error. * could result in a file measurement error.
* *
* Return 0 on success, an error code on failure. * Always return 0 and audit dentry_open failures.
* (Based on the results of appraise_measurement().) * (Return code will be based upon measurement appraisal.)
*/ */
int ima_path_check(struct path *path, int mask, int update_counts) int ima_path_check(struct path *path, int mask, int update_counts)
{ {
...@@ -189,8 +189,13 @@ int ima_path_check(struct path *path, int mask, int update_counts) ...@@ -189,8 +189,13 @@ int ima_path_check(struct path *path, int mask, int update_counts)
file = dentry_open(dentry, mnt, O_RDONLY | O_LARGEFILE, file = dentry_open(dentry, mnt, O_RDONLY | O_LARGEFILE,
current_cred()); current_cred());
if (IS_ERR(file)) { if (IS_ERR(file)) {
pr_info("%s dentry_open failed\n", dentry->d_name.name); int audit_info = 0;
rc = PTR_ERR(file);
integrity_audit_msg(AUDIT_INTEGRITY_PCR, inode,
dentry->d_name.name,
"add_measurement",
"dentry_open failed",
1, audit_info);
file = NULL; file = NULL;
goto out; goto out;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册