diff options
author | Jeff Layton <jlayton@redhat.com> | 2013-04-12 15:16:32 -0400 |
---|---|---|
committer | Eric Paris <eparis@redhat.com> | 2013-05-07 22:27:19 -0400 |
commit | 33e2208acfc15ce00d3dd13e839bf6434faa2b04 (patch) | |
tree | 2a44589c786ee186dccccbb03589716e4ee12a42 /fs/namei.c | |
parent | 780a7654cee8d61819512385e778e4827db4bfbc (diff) |
audit: vfs: fix audit_inode call in O_CREAT case of do_last
Jiri reported a regression in auditing of open(..., O_CREAT) syscalls.
In older kernels, creating a file with open(..., O_CREAT) created
audit_name records that looked like this:
type=PATH msg=audit(1360255720.628:64): item=1 name="/abc/foo" inode=138810 dev=fd:00 mode=0100640 ouid=0 ogid=0 rdev=00:00 obj=unconfined_u:object_r:default_t:s0
type=PATH msg=audit(1360255720.628:64): item=0 name="/abc/" inode=138635 dev=fd:00 mode=040750 ouid=0 ogid=0 rdev=00:00 obj=unconfined_u:object_r:default_t:s0
...in recent kernels though, they look like this:
type=PATH msg=audit(1360255402.886:12574): item=2 name=(null) inode=264599 dev=fd:00 mode=0100640 ouid=0 ogid=0 rdev=00:00 obj=unconfined_u:object_r:default_t:s0
type=PATH msg=audit(1360255402.886:12574): item=1 name=(null) inode=264598 dev=fd:00 mode=040750 ouid=0 ogid=0 rdev=00:00 obj=unconfined_u:object_r:default_t:s0
type=PATH msg=audit(1360255402.886:12574): item=0 name="/abc/foo" inode=264598 dev=fd:00 mode=040750 ouid=0 ogid=0 rdev=00:00 obj=unconfined_u:object_r:default_t:s0
Richard bisected to determine that the problems started with commit
bfcec708, but the log messages have changed with some later
audit-related patches.
The problem is that this audit_inode call is passing in the parent of
the dentry being opened, but audit_inode is being called with the parent
flag false. This causes later audit_inode and audit_inode_child calls to
match the wrong entry in the audit_names list.
This patch simply sets the flag to properly indicate that this inode
represents the parent. With this, the audit_names entries are back to
looking like they did before.
Cc: <stable@vger.kernel.org> # v3.7+
Reported-by: Jiri Jaburek <jjaburek@redhat.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Test By: Richard Guy Briggs <rbriggs@redhat.com>
Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/namei.c b/fs/namei.c index 43a97ee1d4c8..498ede374dc0 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -2751,7 +2751,7 @@ static int do_last(struct nameidata *nd, struct path *path, | |||
2751 | if (error) | 2751 | if (error) |
2752 | return error; | 2752 | return error; |
2753 | 2753 | ||
2754 | audit_inode(name, dir, 0); | 2754 | audit_inode(name, dir, LOOKUP_PARENT); |
2755 | error = -EISDIR; | 2755 | error = -EISDIR; |
2756 | /* trailing slashes? */ | 2756 | /* trailing slashes? */ |
2757 | if (nd->last.name[nd->last.len]) | 2757 | if (nd->last.name[nd->last.len]) |