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:14:55 -0400 |
commit | 91a27b2a756784714e924e5e854b919273082d26 (patch) | |
tree | 3913246b7d6e62703ec915f481e3a7159393f0f0 /include/linux/audit.h | |
parent | 8e377d15078a501c4da98471f56396343c407d92 (diff) |
vfs: define struct filename and have getname() return it
getname() is intended to copy pathname strings from userspace into a
kernel buffer. The result is just a string in kernel space. It would
however be quite helpful to be able to attach some ancillary info to
the string.
For instance, we could attach some audit-related info to reduce the
amount of audit-related processing needed. When auditing is enabled,
we could also call getname() on the string more than once and not
need to recopy it from userspace.
This patchset converts the getname()/putname() interfaces to return
a struct instead of a string. For now, the struct just tracks the
string in kernel space and the original userland pointer for it.
Later, we'll add other information to the struct as it becomes
convenient.
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 | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/include/linux/audit.h b/include/linux/audit.h index 3df643d1ac5b..94d29164803f 100644 --- a/include/linux/audit.h +++ b/include/linux/audit.h | |||
@@ -460,6 +460,8 @@ extern int audit_classify_arch(int arch); | |||
460 | #define AUDIT_TYPE_CHILD_DELETE 3 /* a child being deleted */ | 460 | #define AUDIT_TYPE_CHILD_DELETE 3 /* a child being deleted */ |
461 | #define AUDIT_TYPE_CHILD_CREATE 4 /* a child being created */ | 461 | #define AUDIT_TYPE_CHILD_CREATE 4 /* a child being created */ |
462 | 462 | ||
463 | struct filename; | ||
464 | |||
463 | #ifdef CONFIG_AUDITSYSCALL | 465 | #ifdef CONFIG_AUDITSYSCALL |
464 | /* These are defined in auditsc.c */ | 466 | /* These are defined in auditsc.c */ |
465 | /* Public API */ | 467 | /* Public API */ |
@@ -469,8 +471,8 @@ extern void __audit_syscall_entry(int arch, | |||
469 | int major, unsigned long a0, unsigned long a1, | 471 | int major, unsigned long a0, unsigned long a1, |
470 | unsigned long a2, unsigned long a3); | 472 | unsigned long a2, unsigned long a3); |
471 | extern void __audit_syscall_exit(int ret_success, long ret_value); | 473 | extern void __audit_syscall_exit(int ret_success, long ret_value); |
472 | extern void __audit_getname(const char *name); | 474 | extern void __audit_getname(struct filename *name); |
473 | extern void audit_putname(const char *name); | 475 | extern void audit_putname(struct filename *name); |
474 | extern void __audit_inode(const char *name, const struct dentry *dentry, | 476 | extern void __audit_inode(const char *name, const struct dentry *dentry, |
475 | unsigned int parent); | 477 | unsigned int parent); |
476 | extern void __audit_inode_child(const struct inode *parent, | 478 | extern void __audit_inode_child(const struct inode *parent, |
@@ -505,7 +507,7 @@ static inline void audit_syscall_exit(void *pt_regs) | |||
505 | __audit_syscall_exit(success, return_code); | 507 | __audit_syscall_exit(success, return_code); |
506 | } | 508 | } |
507 | } | 509 | } |
508 | static inline void audit_getname(const char *name) | 510 | static inline void audit_getname(struct filename *name) |
509 | { | 511 | { |
510 | if (unlikely(!audit_dummy_context())) | 512 | if (unlikely(!audit_dummy_context())) |
511 | __audit_getname(name); | 513 | __audit_getname(name); |
@@ -663,9 +665,9 @@ static inline int audit_dummy_context(void) | |||
663 | { | 665 | { |
664 | return 1; | 666 | return 1; |
665 | } | 667 | } |
666 | static inline void audit_getname(const char *name) | 668 | static inline void audit_getname(struct filename *name) |
667 | { } | 669 | { } |
668 | static inline void audit_putname(const char *name) | 670 | static inline void audit_putname(struct filename *name) |
669 | { } | 671 | { } |
670 | static inline void __audit_inode(const char *name, const struct dentry *dentry, | 672 | static inline void __audit_inode(const char *name, const struct dentry *dentry, |
671 | unsigned int parent) | 673 | unsigned int parent) |