path: root/kernel/audit.h
diff options
authorPaul Moore <>2015-01-22 00:00:23 -0500
committerAl Viro <>2015-01-23 00:23:58 -0500
commit55422d0bd292f5ad143cc32cb8bb8505257274c4 (patch)
treefd1d6fae56c5e01d9d8fd6fb2fd913f5e24c7b56 /kernel/audit.h
parent57c59f5837bdfd0b4fee3b02a44857e263a09bfa (diff)
audit: replace getname()/putname() hacks with reference counters
In order to ensure that filenames are not released before the audit subsystem is done with the strings there are a number of hacks built into the fs and audit subsystems around getname() and putname(). To say these hacks are "ugly" would be kind. This patch removes the filename hackery in favor of a more conventional reference count based approach. The diffstat below tells most of the story; lots of audit/fs specific code is replaced with a traditional reference count based approach that is easily understood, even by those not familiar with the audit and/or fs subsystems. CC: CC: Signed-off-by: Paul Moore <> Signed-off-by: Al Viro <>
Diffstat (limited to 'kernel/audit.h')
1 files changed, 2 insertions, 15 deletions
diff --git a/kernel/audit.h b/kernel/audit.h
index 3cdffad5a1d9..1caa0d345d90 100644
--- a/kernel/audit.h
+++ b/kernel/audit.h
@@ -24,12 +24,6 @@
#include <linux/skbuff.h>
#include <uapi/linux/mqueue.h>
-/* 0 = no checking
- 1 = put_count checking
- 2 = verbose put_count checking
-#define AUDIT_DEBUG 0
/* AUDIT_NAMES is the number of slots we reserve in the audit_context
* for saving names from getname(). If we get more names we will allocate
* a name dynamically and also add those to the list anchored by names_list. */
@@ -74,9 +68,8 @@ struct audit_cap_data {
-/* When fs/namei.c:getname() is called, we store the pointer in name and
- * we don't let putname() free it (instead we free all of the saved
- * pointers at syscall exit time).
+/* When fs/namei.c:getname() is called, we store the pointer in name and bump
+ * the refcnt in the associated filename struct.
* Further, in fs/namei.c:path_lookup() we store the inode and device.
@@ -86,7 +79,6 @@ struct audit_names {
struct filename *name;
int name_len; /* number of chars to log */
bool hidden; /* don't log this record */
- bool name_put; /* call __putname()? */
unsigned long ino;
dev_t dev;
@@ -208,11 +200,6 @@ struct audit_context {
int fds[2];
struct audit_proctitle proctitle;
- int put_count;
- int ino_count;
extern u32 audit_ever_enabled;