aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/audit.h6
-rw-r--r--kernel/auditsc.c6
2 files changed, 10 insertions, 2 deletions
diff --git a/include/linux/audit.h b/include/linux/audit.h
index f1bfcff497bf..3f736d658218 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -329,6 +329,11 @@ extern void __audit_inode(const char *name, const struct inode *inode);
329extern void __audit_inode_child(const char *dname, const struct inode *inode, 329extern void __audit_inode_child(const char *dname, const struct inode *inode,
330 const struct inode *parent); 330 const struct inode *parent);
331extern void __audit_inode_update(const struct inode *inode); 331extern void __audit_inode_update(const struct inode *inode);
332static inline int audit_dummy_context(void)
333{
334 void *p = current->audit_context;
335 return !p || *(int *)p;
336}
332static inline void audit_getname(const char *name) 337static inline void audit_getname(const char *name)
333{ 338{
334 if (unlikely(current->audit_context)) 339 if (unlikely(current->audit_context))
@@ -416,6 +421,7 @@ extern int audit_n_rules;
416#define audit_free(t) do { ; } while (0) 421#define audit_free(t) do { ; } while (0)
417#define audit_syscall_entry(ta,a,b,c,d,e) do { ; } while (0) 422#define audit_syscall_entry(ta,a,b,c,d,e) do { ; } while (0)
418#define audit_syscall_exit(f,r) do { ; } while (0) 423#define audit_syscall_exit(f,r) do { ; } while (0)
424#define audit_dummy_context() 1
419#define audit_getname(n) do { ; } while (0) 425#define audit_getname(n) do { ; } while (0)
420#define audit_putname(n) do { ; } while (0) 426#define audit_putname(n) do { ; } while (0)
421#define __audit_inode(n,i) do { ; } while (0) 427#define __audit_inode(n,i) do { ; } while (0)
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 3ea836d3d941..9618d1507251 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -177,6 +177,7 @@ struct audit_aux_data_path {
177 177
178/* The per-task audit context. */ 178/* The per-task audit context. */
179struct audit_context { 179struct audit_context {
180 int dummy; /* must be the first element */
180 int in_syscall; /* 1 if task is in a syscall */ 181 int in_syscall; /* 1 if task is in a syscall */
181 enum audit_state state; 182 enum audit_state state;
182 unsigned int serial; /* serial number for record */ 183 unsigned int serial; /* serial number for record */
@@ -517,7 +518,7 @@ static inline struct audit_context *audit_get_context(struct task_struct *tsk,
517 context->return_valid = return_valid; 518 context->return_valid = return_valid;
518 context->return_code = return_code; 519 context->return_code = return_code;
519 520
520 if (context->in_syscall && !context->auditable) { 521 if (context->in_syscall && !context->dummy && !context->auditable) {
521 enum audit_state state; 522 enum audit_state state;
522 523
523 state = audit_filter_syscall(tsk, context, &audit_filter_list[AUDIT_FILTER_EXIT]); 524 state = audit_filter_syscall(tsk, context, &audit_filter_list[AUDIT_FILTER_EXIT]);
@@ -1069,7 +1070,8 @@ void audit_syscall_entry(int arch, int major,
1069 context->argv[3] = a4; 1070 context->argv[3] = a4;
1070 1071
1071 state = context->state; 1072 state = context->state;
1072 if (state == AUDIT_SETUP_CONTEXT || state == AUDIT_BUILD_CONTEXT) 1073 context->dummy = !audit_n_rules;
1074 if (!context->dummy && (state == AUDIT_SETUP_CONTEXT || state == AUDIT_BUILD_CONTEXT))
1073 state = audit_filter_syscall(tsk, context, &audit_filter_list[AUDIT_FILTER_ENTRY]); 1075 state = audit_filter_syscall(tsk, context, &audit_filter_list[AUDIT_FILTER_ENTRY]);
1074 if (likely(state == AUDIT_DISABLED)) 1076 if (likely(state == AUDIT_DISABLED))
1075 return; 1077 return;