* [PATCH] integrity: ima audit dentry_open failure
@ 2009-06-04 17:53 Mimi Zohar
2009-06-04 18:14 ` Eric Paris
2009-06-04 22:03 ` James Morris
0 siblings, 2 replies; 3+ messages in thread
From: Mimi Zohar @ 2009-06-04 17:53 UTC (permalink / raw)
To: linux-kernel
Cc: Mimi Zohar, James Morris, vibi sreenivasan, Jiri Slaby,
Eric Paris, David Safford, Mimi Zohar
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: Mimi Zohar <zohar@us.ibm.com>
---
security/integrity/ima/ima_main.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c
index a2eb233..6f61187 100644
--- a/security/integrity/ima/ima_main.c
+++ b/security/integrity/ima/ima_main.c
@@ -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,
* could result in a file measurement error.
*
- * Return 0 on success, an error code on failure.
- * (Based on the results of appraise_measurement().)
+ * Always return 0 and audit dentry_open failures.
+ * (Return code will be based upon measurement appraisal.)
*/
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,
current_cred());
if (IS_ERR(file)) {
- pr_info("%s dentry_open failed\n", dentry->d_name.name);
- rc = PTR_ERR(file);
+ int audit_info = 0;
+
+ integrity_audit_msg(AUDIT_INTEGRITY_PCR, inode,
+ dentry->d_name.name,
+ "add_measurement",
+ "dentry_open failed",
+ 1, audit_info);
file = NULL;
goto out;
}
--
1.6.0.6
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] integrity: ima audit dentry_open failure
2009-06-04 17:53 [PATCH] integrity: ima audit dentry_open failure Mimi Zohar
@ 2009-06-04 18:14 ` Eric Paris
2009-06-04 22:03 ` James Morris
1 sibling, 0 replies; 3+ messages in thread
From: Eric Paris @ 2009-06-04 18:14 UTC (permalink / raw)
To: Mimi Zohar
Cc: linux-kernel, James Morris, vibi sreenivasan, Jiri Slaby,
David Safford, Mimi Zohar
On Thu, 2009-06-04 at 13:53 -0400, Mimi Zohar wrote:
> 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: Mimi Zohar <zohar@us.ibm.com>
So I'm not a big fan of the needless stack variable declaration. This
isn't the only spot you do it (and sometimes you do actually make use of
the variable like ima_add_template_entry) but I'm guessing the compiler
will clean it up, so
Acked-by: Eric Paris <eparis@redhat.com>
>
> ---
> security/integrity/ima/ima_main.c | 13 +++++++++----
> 1 files changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c
> index a2eb233..6f61187 100644
> --- a/security/integrity/ima/ima_main.c
> +++ b/security/integrity/ima/ima_main.c
> @@ -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,
> * could result in a file measurement error.
> *
> - * Return 0 on success, an error code on failure.
> - * (Based on the results of appraise_measurement().)
> + * Always return 0 and audit dentry_open failures.
> + * (Return code will be based upon measurement appraisal.)
> */
> 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,
> current_cred());
> if (IS_ERR(file)) {
> - pr_info("%s dentry_open failed\n", dentry->d_name.name);
> - rc = PTR_ERR(file);
> + int audit_info = 0;
> +
> + integrity_audit_msg(AUDIT_INTEGRITY_PCR, inode,
> + dentry->d_name.name,
> + "add_measurement",
> + "dentry_open failed",
> + 1, audit_info);
> file = NULL;
> goto out;
> }
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] integrity: ima audit dentry_open failure
2009-06-04 17:53 [PATCH] integrity: ima audit dentry_open failure Mimi Zohar
2009-06-04 18:14 ` Eric Paris
@ 2009-06-04 22:03 ` James Morris
1 sibling, 0 replies; 3+ messages in thread
From: James Morris @ 2009-06-04 22:03 UTC (permalink / raw)
To: Mimi Zohar
Cc: linux-kernel, vibi sreenivasan, Jiri Slaby, Eric Paris,
David Safford, Mimi Zohar
On Thu, 4 Jun 2009, Mimi Zohar wrote:
> 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: Mimi Zohar <zohar@us.ibm.com>
Applied to
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6#next
--
James Morris
<jmorris@namei.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-06-04 22:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-04 17:53 [PATCH] integrity: ima audit dentry_open failure Mimi Zohar
2009-06-04 18:14 ` Eric Paris
2009-06-04 22:03 ` James Morris
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®