2007-06-20 22:37:59

by Tony Jones

[permalink] [raw]
Subject: [PATCH 1/1] audit: fix oops removing watch if audit disabled

Removing a watched file will oops if audit is disabled (auditctl -e 0).

To reproduce:
- auditctl -e 1
- touch /tmp/foo
- auditctl -w /tmp/foo
- auditctl -e 0
- rm /tmp/foo (or mv)

Signed-off-by: Tony Jones <[email protected]>
---

diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
index 74cc0fc..ce61f42 100644
--- a/kernel/auditfilter.c
+++ b/kernel/auditfilter.c
@@ -947,7 +947,7 @@ static void audit_update_watch(struct au

/* If the update involves invalidating rules, do the inode-based
* filtering now, so we don't omit records. */
- if (invalidating &&
+ if (invalidating && current->audit_context &&
audit_filter_inodes(current, current->audit_context) == AUDIT_RECORD_CONTEXT)
audit_set_auditable(current->audit_context);


2007-06-23 16:52:44

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH 1/1] audit: fix oops removing watch if audit disabled

> On Wed, 20 Jun 2007 15:38:20 -0700 Tony Jones <[email protected]> wrote:
> Removing a watched file will oops if audit is disabled (auditctl -e 0).
>
> To reproduce:
> - auditctl -e 1
> - touch /tmp/foo
> - auditctl -w /tmp/foo
> - auditctl -e 0
> - rm /tmp/foo (or mv)
>
> Signed-off-by: Tony Jones <[email protected]>
> ---
>
> diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
> index 74cc0fc..ce61f42 100644
> --- a/kernel/auditfilter.c
> +++ b/kernel/auditfilter.c
> @@ -947,7 +947,7 @@ static void audit_update_watch(struct au
>
> /* If the update involves invalidating rules, do the inode-based
> * filtering now, so we don't omit records. */
> - if (invalidating &&
> + if (invalidating && current->audit_context &&
> audit_filter_inodes(current, current->audit_context) == AUDIT_RECORD_CONTEXT)
> audit_set_auditable(current->audit_context);

This looks like 2.6.22 material to me.

Question is: is it also 2.6.21.x material?

2007-06-23 16:59:09

by S.Çağlar Onur

[permalink] [raw]
Subject: Re: [PATCH 1/1] audit: fix oops removing watch if audit disabled

23 Haz 2007 Cts tarihinde, Andrew Morton şunları yazmıştı:
> This looks like 2.6.22 material to me.
>
> Question is: is it also 2.6.21.x material?

I even can reproduce same oops with 2.6.18 :)

Cheers
--
S.Çağlar Onur <[email protected]>
http://cekirdek.pardus.org.tr/~caglar/

Linux is like living in a teepee. No Windows, no Gates and an Apache in house!


Attachments:
(No filename) (370.00 B)
signature.asc (189.00 B)
This is a digitally signed message part.
Download all attachments

2007-06-23 19:16:21

by Al Viro

[permalink] [raw]
Subject: Re: [PATCH 1/1] audit: fix oops removing watch if audit disabled

On Sat, Jun 23, 2007 at 09:51:53AM -0700, Andrew Morton wrote:
> This looks like 2.6.22 material to me.
>
> Question is: is it also 2.6.21.x material?

Yes, it is.

2007-06-23 19:20:20

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH 1/1] audit: fix oops removing watch if audit disabled

On Sat, 23 Jun 2007 20:16:09 +0100 Al Viro <[email protected]> wrote:

> On Sat, Jun 23, 2007 at 09:51:53AM -0700, Andrew Morton wrote:
> > This looks like 2.6.22 material to me.
> >
> > Question is: is it also 2.6.21.x material?
>
> Yes, it is.

OK, thanks, I queued it for both kernels.