From 7ac86265dc8f665cc49d6e60a125e608cd2fca14 Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Wed, 10 Oct 2012 15:25:28 -0400 Subject: audit: allow audit code to satisfy getname requests from its names_list Currently, if we call getname() on a userland string more than once, we'll get multiple copies of the string and multiple audit_names records. Add a function that will allow the audit_names code to satisfy getname requests using info from the audit_names list, avoiding a new allocation and audit_names records. Signed-off-by: Jeff Layton Signed-off-by: Al Viro --- include/linux/audit.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include/linux/audit.h') diff --git a/include/linux/audit.h b/include/linux/audit.h index 94d29164803f..d5d7952ab7d8 100644 --- a/include/linux/audit.h +++ b/include/linux/audit.h @@ -471,6 +471,7 @@ extern void __audit_syscall_entry(int arch, int major, unsigned long a0, unsigned long a1, unsigned long a2, unsigned long a3); extern void __audit_syscall_exit(int ret_success, long ret_value); +extern struct filename *__audit_reusename(const __user char *uptr); extern void __audit_getname(struct filename *name); extern void audit_putname(struct filename *name); extern void __audit_inode(const char *name, const struct dentry *dentry, @@ -507,6 +508,12 @@ static inline void audit_syscall_exit(void *pt_regs) __audit_syscall_exit(success, return_code); } } +static inline struct filename *audit_reusename(const __user char *name) +{ + if (unlikely(!audit_dummy_context())) + return __audit_reusename(name); + return NULL; +} static inline void audit_getname(struct filename *name) { if (unlikely(!audit_dummy_context())) @@ -665,6 +672,10 @@ static inline int audit_dummy_context(void) { return 1; } +static inline struct filename *audit_reusename(const __user char *name) +{ + return NULL; +} static inline void audit_getname(struct filename *name) { } static inline void audit_putname(struct filename *name) -- cgit v1.2.3