Commit 5ac3a9c2 authored by Al Viro's avatar Al Viro

[PATCH] don't bother with aux entires for dummy context

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent d51374ad
...@@ -159,7 +159,7 @@ char * getname(const char __user * filename) ...@@ -159,7 +159,7 @@ char * getname(const char __user * filename)
#ifdef CONFIG_AUDITSYSCALL #ifdef CONFIG_AUDITSYSCALL
void putname(const char *name) void putname(const char *name)
{ {
if (unlikely(current->audit_context)) if (unlikely(!audit_dummy_context()))
audit_putname(name); audit_putname(name);
else else
__putname(name); __putname(name);
...@@ -1125,7 +1125,7 @@ static int fastcall do_path_lookup(int dfd, const char *name, ...@@ -1125,7 +1125,7 @@ static int fastcall do_path_lookup(int dfd, const char *name,
retval = link_path_walk(name, nd); retval = link_path_walk(name, nd);
out: out:
if (likely(retval == 0)) { if (likely(retval == 0)) {
if (unlikely(current->audit_context && nd && nd->dentry && if (unlikely(!audit_dummy_context() && nd && nd->dentry &&
nd->dentry->d_inode)) nd->dentry->d_inode))
audit_inode(name, nd->dentry->d_inode); audit_inode(name, nd->dentry->d_inode);
} }
......
...@@ -336,21 +336,21 @@ static inline int audit_dummy_context(void) ...@@ -336,21 +336,21 @@ static inline int audit_dummy_context(void)
} }
static inline void audit_getname(const char *name) static inline void audit_getname(const char *name)
{ {
if (unlikely(current->audit_context)) if (unlikely(!audit_dummy_context()))
__audit_getname(name); __audit_getname(name);
} }
static inline void audit_inode(const char *name, const struct inode *inode) { static inline void audit_inode(const char *name, const struct inode *inode) {
if (unlikely(current->audit_context)) if (unlikely(!audit_dummy_context()))
__audit_inode(name, inode); __audit_inode(name, inode);
} }
static inline void audit_inode_child(const char *dname, static inline void audit_inode_child(const char *dname,
const struct inode *inode, const struct inode *inode,
const struct inode *parent) { const struct inode *parent) {
if (unlikely(current->audit_context)) if (unlikely(!audit_dummy_context()))
__audit_inode_child(dname, inode, parent); __audit_inode_child(dname, inode, parent);
} }
static inline void audit_inode_update(const struct inode *inode) { static inline void audit_inode_update(const struct inode *inode) {
if (unlikely(current->audit_context)) if (unlikely(!audit_dummy_context()))
__audit_inode_update(inode); __audit_inode_update(inode);
} }
...@@ -375,43 +375,43 @@ extern int __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat); ...@@ -375,43 +375,43 @@ extern int __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat);
static inline int audit_ipc_obj(struct kern_ipc_perm *ipcp) static inline int audit_ipc_obj(struct kern_ipc_perm *ipcp)
{ {
if (unlikely(current->audit_context)) if (unlikely(!audit_dummy_context()))
return __audit_ipc_obj(ipcp); return __audit_ipc_obj(ipcp);
return 0; return 0;
} }
static inline int audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode) static inline int audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode)
{ {
if (unlikely(current->audit_context)) if (unlikely(!audit_dummy_context()))
return __audit_ipc_set_perm(qbytes, uid, gid, mode); return __audit_ipc_set_perm(qbytes, uid, gid, mode);
return 0; return 0;
} }
static inline int audit_mq_open(int oflag, mode_t mode, struct mq_attr __user *u_attr) static inline int audit_mq_open(int oflag, mode_t mode, struct mq_attr __user *u_attr)
{ {
if (unlikely(current->audit_context)) if (unlikely(!audit_dummy_context()))
return __audit_mq_open(oflag, mode, u_attr); return __audit_mq_open(oflag, mode, u_attr);
return 0; return 0;
} }
static inline int audit_mq_timedsend(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec __user *u_abs_timeout) static inline int audit_mq_timedsend(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec __user *u_abs_timeout)
{ {
if (unlikely(current->audit_context)) if (unlikely(!audit_dummy_context()))
return __audit_mq_timedsend(mqdes, msg_len, msg_prio, u_abs_timeout); return __audit_mq_timedsend(mqdes, msg_len, msg_prio, u_abs_timeout);
return 0; return 0;
} }
static inline int audit_mq_timedreceive(mqd_t mqdes, size_t msg_len, unsigned int __user *u_msg_prio, const struct timespec __user *u_abs_timeout) static inline int audit_mq_timedreceive(mqd_t mqdes, size_t msg_len, unsigned int __user *u_msg_prio, const struct timespec __user *u_abs_timeout)
{ {
if (unlikely(current->audit_context)) if (unlikely(!audit_dummy_context()))
return __audit_mq_timedreceive(mqdes, msg_len, u_msg_prio, u_abs_timeout); return __audit_mq_timedreceive(mqdes, msg_len, u_msg_prio, u_abs_timeout);
return 0; return 0;
} }
static inline int audit_mq_notify(mqd_t mqdes, const struct sigevent __user *u_notification) static inline int audit_mq_notify(mqd_t mqdes, const struct sigevent __user *u_notification)
{ {
if (unlikely(current->audit_context)) if (unlikely(!audit_dummy_context()))
return __audit_mq_notify(mqdes, u_notification); return __audit_mq_notify(mqdes, u_notification);
return 0; return 0;
} }
static inline int audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat) static inline int audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat)
{ {
if (unlikely(current->audit_context)) if (unlikely(!audit_dummy_context()))
return __audit_mq_getsetattr(mqdes, mqstat); return __audit_mq_getsetattr(mqdes, mqstat);
return 0; return 0;
} }
......
...@@ -1676,7 +1676,7 @@ int audit_bprm(struct linux_binprm *bprm) ...@@ -1676,7 +1676,7 @@ int audit_bprm(struct linux_binprm *bprm)
unsigned long p, next; unsigned long p, next;
void *to; void *to;
if (likely(!audit_enabled || !context)) if (likely(!audit_enabled || !context || context->dummy))
return 0; return 0;
ax = kmalloc(sizeof(*ax) + PAGE_SIZE * MAX_ARG_PAGES - bprm->p, ax = kmalloc(sizeof(*ax) + PAGE_SIZE * MAX_ARG_PAGES - bprm->p,
...@@ -1714,7 +1714,7 @@ int audit_socketcall(int nargs, unsigned long *args) ...@@ -1714,7 +1714,7 @@ int audit_socketcall(int nargs, unsigned long *args)
struct audit_aux_data_socketcall *ax; struct audit_aux_data_socketcall *ax;
struct audit_context *context = current->audit_context; struct audit_context *context = current->audit_context;
if (likely(!context)) if (likely(!context || context->dummy))
return 0; return 0;
ax = kmalloc(sizeof(*ax) + nargs * sizeof(unsigned long), GFP_KERNEL); ax = kmalloc(sizeof(*ax) + nargs * sizeof(unsigned long), GFP_KERNEL);
...@@ -1742,7 +1742,7 @@ int audit_sockaddr(int len, void *a) ...@@ -1742,7 +1742,7 @@ int audit_sockaddr(int len, void *a)
struct audit_aux_data_sockaddr *ax; struct audit_aux_data_sockaddr *ax;
struct audit_context *context = current->audit_context; struct audit_context *context = current->audit_context;
if (likely(!context)) if (likely(!context || context->dummy))
return 0; return 0;
ax = kmalloc(sizeof(*ax) + len, GFP_KERNEL); ax = kmalloc(sizeof(*ax) + len, GFP_KERNEL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment