diff options
author | Jeff Layton <jlayton@redhat.com> | 2012-10-10 15:25:28 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-10-12 20:15:08 -0400 |
commit | 7ac86265dc8f665cc49d6e60a125e608cd2fca14 (patch) | |
tree | 9e7941e2d8dfb2106c5fb28504531dafc72e14e6 /include/linux/audit.h | |
parent | 91a27b2a756784714e924e5e854b919273082d26 (diff) |
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 <jlayton@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'include/linux/audit.h')
-rw-r--r-- | include/linux/audit.h | 11 |
1 files changed, 11 insertions, 0 deletions
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, | |||
471 | int major, unsigned long a0, unsigned long a1, | 471 | int major, unsigned long a0, unsigned long a1, |
472 | unsigned long a2, unsigned long a3); | 472 | unsigned long a2, unsigned long a3); |
473 | extern void __audit_syscall_exit(int ret_success, long ret_value); | 473 | extern void __audit_syscall_exit(int ret_success, long ret_value); |
474 | extern struct filename *__audit_reusename(const __user char *uptr); | ||
474 | extern void __audit_getname(struct filename *name); | 475 | extern void __audit_getname(struct filename *name); |
475 | extern void audit_putname(struct filename *name); | 476 | extern void audit_putname(struct filename *name); |
476 | extern void __audit_inode(const char *name, const struct dentry *dentry, | 477 | extern void __audit_inode(const char *name, const struct dentry *dentry, |
@@ -507,6 +508,12 @@ static inline void audit_syscall_exit(void *pt_regs) | |||
507 | __audit_syscall_exit(success, return_code); | 508 | __audit_syscall_exit(success, return_code); |
508 | } | 509 | } |
509 | } | 510 | } |
511 | static inline struct filename *audit_reusename(const __user char *name) | ||
512 | { | ||
513 | if (unlikely(!audit_dummy_context())) | ||
514 | return __audit_reusename(name); | ||
515 | return NULL; | ||
516 | } | ||
510 | static inline void audit_getname(struct filename *name) | 517 | static inline void audit_getname(struct filename *name) |
511 | { | 518 | { |
512 | if (unlikely(!audit_dummy_context())) | 519 | if (unlikely(!audit_dummy_context())) |
@@ -665,6 +672,10 @@ static inline int audit_dummy_context(void) | |||
665 | { | 672 | { |
666 | return 1; | 673 | return 1; |
667 | } | 674 | } |
675 | static inline struct filename *audit_reusename(const __user char *name) | ||
676 | { | ||
677 | return NULL; | ||
678 | } | ||
668 | static inline void audit_getname(struct filename *name) | 679 | static inline void audit_getname(struct filename *name) |
669 | { } | 680 | { } |
670 | static inline void audit_putname(struct filename *name) | 681 | static inline void audit_putname(struct filename *name) |