aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2013-07-08 18:59:36 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-12-04 13:57:03 -0500
commit24dccf86dd157e545698fdea4723ddf6f699ed87 (patch)
tree54e0d824170529341f28b2266d7467d5a4cfbfea /include
parent3dc7095c8e78dfeb20dce066fe8bfdfd8497212e (diff)
audit: fix mq_open and mq_unlink to add the MQ root as a hidden parent audit_names record
commit 79f6530cb59e2a0af6953742a33cc29e98ca631c upstream. The old audit PATH records for mq_open looked like this: type=PATH msg=audit(1366282323.982:869): item=1 name=(null) inode=6777 dev=00:0c mode=041777 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:tmpfs_t:s15:c0.c1023 type=PATH msg=audit(1366282323.982:869): item=0 name="test_mq" inode=26732 dev=00:0c mode=0100700 ouid=0 ogid=0 rdev=00:00 obj=staff_u:object_r:user_tmpfs_t:s15:c0.c1023 ...with the audit related changes that went into 3.7, they now look like this: type=PATH msg=audit(1366282236.776:3606): item=2 name=(null) inode=66655 dev=00:0c mode=0100700 ouid=0 ogid=0 rdev=00:00 obj=staff_u:object_r:user_tmpfs_t:s15:c0.c1023 type=PATH msg=audit(1366282236.776:3606): item=1 name=(null) inode=6926 dev=00:0c mode=041777 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:tmpfs_t:s15:c0.c1023 type=PATH msg=audit(1366282236.776:3606): item=0 name="test_mq" Both of these look wrong to me. As Steve Grubb pointed out: "What we need is 1 PATH record that identifies the MQ. The other PATH records probably should not be there." Fix it to record the mq root as a parent, and flag it such that it should be hidden from view when the names are logged, since the root of the mq filesystem isn't terribly interesting. With this change, we get a single PATH record that looks more like this: type=PATH msg=audit(1368021604.836:484): item=0 name="test_mq" inode=16914 dev=00:0c mode=0100644 ouid=0 ogid=0 rdev=00:00 obj=unconfined_u:object_r:user_tmpfs_t:s0 In order to do this, a new audit_inode_parent_hidden() function is added. If we do it this way, then we avoid having the existing callers of audit_inode needing to do any sort of flag conversion if auditing is inactive. Signed-off-by: Jeff Layton <jlayton@redhat.com> Reported-by: Jiri Jaburek <jjaburek@redhat.com> Cc: Steve Grubb <sgrubb@redhat.com> Cc: Eric Paris <eparis@redhat.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/audit.h26
1 files changed, 22 insertions, 4 deletions
diff --git a/include/linux/audit.h b/include/linux/audit.h
index b20b03852f21..729a4d165bcc 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -103,8 +103,11 @@ extern void __audit_syscall_exit(int ret_success, long ret_value);
103extern struct filename *__audit_reusename(const __user char *uptr); 103extern struct filename *__audit_reusename(const __user char *uptr);
104extern void __audit_getname(struct filename *name); 104extern void __audit_getname(struct filename *name);
105extern void audit_putname(struct filename *name); 105extern void audit_putname(struct filename *name);
106
107#define AUDIT_INODE_PARENT 1 /* dentry represents the parent */
108#define AUDIT_INODE_HIDDEN 2 /* audit record should be hidden */
106extern void __audit_inode(struct filename *name, const struct dentry *dentry, 109extern void __audit_inode(struct filename *name, const struct dentry *dentry,
107 unsigned int parent); 110 unsigned int flags);
108extern void __audit_inode_child(const struct inode *parent, 111extern void __audit_inode_child(const struct inode *parent,
109 const struct dentry *dentry, 112 const struct dentry *dentry,
110 const unsigned char type); 113 const unsigned char type);
@@ -148,10 +151,22 @@ static inline void audit_getname(struct filename *name)
148 if (unlikely(!audit_dummy_context())) 151 if (unlikely(!audit_dummy_context()))
149 __audit_getname(name); 152 __audit_getname(name);
150} 153}
151static inline void audit_inode(struct filename *name, const struct dentry *dentry, 154static inline void audit_inode(struct filename *name,
155 const struct dentry *dentry,
152 unsigned int parent) { 156 unsigned int parent) {
157 if (unlikely(!audit_dummy_context())) {
158 unsigned int flags = 0;
159 if (parent)
160 flags |= AUDIT_INODE_PARENT;
161 __audit_inode(name, dentry, flags);
162 }
163}
164static inline void audit_inode_parent_hidden(struct filename *name,
165 const struct dentry *dentry)
166{
153 if (unlikely(!audit_dummy_context())) 167 if (unlikely(!audit_dummy_context()))
154 __audit_inode(name, dentry, parent); 168 __audit_inode(name, dentry,
169 AUDIT_INODE_PARENT | AUDIT_INODE_HIDDEN);
155} 170}
156static inline void audit_inode_child(const struct inode *parent, 171static inline void audit_inode_child(const struct inode *parent,
157 const struct dentry *dentry, 172 const struct dentry *dentry,
@@ -311,7 +326,7 @@ static inline void audit_putname(struct filename *name)
311{ } 326{ }
312static inline void __audit_inode(struct filename *name, 327static inline void __audit_inode(struct filename *name,
313 const struct dentry *dentry, 328 const struct dentry *dentry,
314 unsigned int parent) 329 unsigned int flags)
315{ } 330{ }
316static inline void __audit_inode_child(const struct inode *parent, 331static inline void __audit_inode_child(const struct inode *parent,
317 const struct dentry *dentry, 332 const struct dentry *dentry,
@@ -321,6 +336,9 @@ static inline void audit_inode(struct filename *name,
321 const struct dentry *dentry, 336 const struct dentry *dentry,
322 unsigned int parent) 337 unsigned int parent)
323{ } 338{ }
339static inline void audit_inode_parent_hidden(struct filename *name,
340 const struct dentry *dentry)
341{ }
324static inline void audit_inode_child(const struct inode *parent, 342static inline void audit_inode_child(const struct inode *parent,
325 const struct dentry *dentry, 343 const struct dentry *dentry,
326 const unsigned char type) 344 const unsigned char type)