aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2012-10-10 15:25:22 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-10-12 00:32:00 -0400
commit78e2e802a8519031e5858595070b39713e26340d (patch)
tree92f79d2039f4119a127ab59e31a2d1c9dfb892fe /kernel
parentc43a25abba97c7d87131e71db6be24b24d7791a5 (diff)
audit: add a new "type" field to audit_names struct
For now, we just have two possibilities: UNKNOWN: for a new audit_names record that we don't know anything about yet NORMAL: for everything else In later patches, we'll add other types so we can distinguish and update records created under different circumstances. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/auditsc.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 40743af02d8..19b232f86d7 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -120,6 +120,7 @@ struct audit_names {
120 struct audit_cap_data fcap; 120 struct audit_cap_data fcap;
121 unsigned int fcap_ver; 121 unsigned int fcap_ver;
122 int name_len; /* number of name's characters to log */ 122 int name_len; /* number of name's characters to log */
123 unsigned char type; /* record type */
123 bool name_put; /* call __putname() for this name */ 124 bool name_put; /* call __putname() for this name */
124 /* 125 /*
125 * This was an allocated audit_names and not from the array of 126 * This was an allocated audit_names and not from the array of
@@ -1995,7 +1996,8 @@ retry:
1995#endif 1996#endif
1996} 1997}
1997 1998
1998static struct audit_names *audit_alloc_name(struct audit_context *context) 1999static struct audit_names *audit_alloc_name(struct audit_context *context,
2000 unsigned char type)
1999{ 2001{
2000 struct audit_names *aname; 2002 struct audit_names *aname;
2001 2003
@@ -2010,6 +2012,7 @@ static struct audit_names *audit_alloc_name(struct audit_context *context)
2010 } 2012 }
2011 2013
2012 aname->ino = (unsigned long)-1; 2014 aname->ino = (unsigned long)-1;
2015 aname->type = type;
2013 list_add_tail(&aname->list, &context->names_list); 2016 list_add_tail(&aname->list, &context->names_list);
2014 2017
2015 context->name_count++; 2018 context->name_count++;
@@ -2040,7 +2043,7 @@ void __audit_getname(const char *name)
2040 return; 2043 return;
2041 } 2044 }
2042 2045
2043 n = audit_alloc_name(context); 2046 n = audit_alloc_name(context, AUDIT_TYPE_UNKNOWN);
2044 if (!n) 2047 if (!n)
2045 return; 2048 return;
2046 2049
@@ -2157,12 +2160,13 @@ void __audit_inode(const char *name, const struct dentry *dentry)
2157 2160
2158out_alloc: 2161out_alloc:
2159 /* unable to find the name from a previous getname() */ 2162 /* unable to find the name from a previous getname() */
2160 n = audit_alloc_name(context); 2163 n = audit_alloc_name(context, AUDIT_TYPE_NORMAL);
2161 if (!n) 2164 if (!n)
2162 return; 2165 return;
2163out: 2166out:
2164 handle_path(dentry); 2167 handle_path(dentry);
2165 audit_copy_inode(n, dentry, inode); 2168 audit_copy_inode(n, dentry, inode);
2169 n->type = AUDIT_TYPE_NORMAL;
2166} 2170}
2167 2171
2168/** 2172/**
@@ -2219,6 +2223,7 @@ void __audit_inode_child(const struct inode *parent,
2219 audit_copy_inode(n, dentry, inode); 2223 audit_copy_inode(n, dentry, inode);
2220 else 2224 else
2221 n->ino = (unsigned long)-1; 2225 n->ino = (unsigned long)-1;
2226 n->type = AUDIT_TYPE_NORMAL;
2222 found_child = n->name; 2227 found_child = n->name;
2223 goto add_names; 2228 goto add_names;
2224 } 2229 }
@@ -2226,14 +2231,14 @@ void __audit_inode_child(const struct inode *parent,
2226 2231
2227add_names: 2232add_names:
2228 if (!found_parent) { 2233 if (!found_parent) {
2229 n = audit_alloc_name(context); 2234 n = audit_alloc_name(context, AUDIT_TYPE_NORMAL);
2230 if (!n) 2235 if (!n)
2231 return; 2236 return;
2232 audit_copy_inode(n, NULL, parent); 2237 audit_copy_inode(n, NULL, parent);
2233 } 2238 }
2234 2239
2235 if (!found_child) { 2240 if (!found_child) {
2236 n = audit_alloc_name(context); 2241 n = audit_alloc_name(context, AUDIT_TYPE_NORMAL);
2237 if (!n) 2242 if (!n)
2238 return; 2243 return;
2239 2244