diff options
| -rw-r--r-- | include/linux/audit.h | 15 | ||||
| -rw-r--r-- | include/net/xfrm.h | 2 | ||||
| -rw-r--r-- | kernel/audit.c | 6 | ||||
| -rw-r--r-- | kernel/audit_watch.c | 2 | ||||
| -rw-r--r-- | kernel/auditsc.c | 66 | ||||
| -rw-r--r-- | net/bridge/netfilter/ebtables.c | 2 | ||||
| -rw-r--r-- | net/core/dev.c | 18 | ||||
| -rw-r--r-- | net/netfilter/x_tables.c | 2 | ||||
| -rw-r--r-- | net/netlabel/netlabel_user.c | 2 | ||||
| -rw-r--r-- | security/integrity/ima/ima_api.c | 2 | ||||
| -rw-r--r-- | security/integrity/integrity_audit.c | 2 | ||||
| -rw-r--r-- | security/lsm_audit.c | 2 | ||||
| -rw-r--r-- | security/selinux/hooks.c | 7 | ||||
| -rw-r--r-- | security/selinux/selinuxfs.c | 6 | ||||
| -rw-r--r-- | security/selinux/ss/services.c | 12 |
15 files changed, 77 insertions, 69 deletions
diff --git a/include/linux/audit.h b/include/linux/audit.h index 2d15bce7aa3c..831a4684df40 100644 --- a/include/linux/audit.h +++ b/include/linux/audit.h | |||
| @@ -237,9 +237,14 @@ extern void audit_seccomp_actions_logged(const char *names, | |||
| 237 | const char *old_names, int res); | 237 | const char *old_names, int res); |
| 238 | extern void __audit_ptrace(struct task_struct *t); | 238 | extern void __audit_ptrace(struct task_struct *t); |
| 239 | 239 | ||
| 240 | static inline struct audit_context *audit_context(void) | ||
| 241 | { | ||
| 242 | return current->audit_context; | ||
| 243 | } | ||
| 244 | |||
| 240 | static inline bool audit_dummy_context(void) | 245 | static inline bool audit_dummy_context(void) |
| 241 | { | 246 | { |
| 242 | void *p = current->audit_context; | 247 | void *p = audit_context(); |
| 243 | return !p || *(int *)p; | 248 | return !p || *(int *)p; |
| 244 | } | 249 | } |
| 245 | static inline void audit_free(struct task_struct *task) | 250 | static inline void audit_free(struct task_struct *task) |
| @@ -251,12 +256,12 @@ static inline void audit_syscall_entry(int major, unsigned long a0, | |||
| 251 | unsigned long a1, unsigned long a2, | 256 | unsigned long a1, unsigned long a2, |
| 252 | unsigned long a3) | 257 | unsigned long a3) |
| 253 | { | 258 | { |
| 254 | if (unlikely(current->audit_context)) | 259 | if (unlikely(audit_context())) |
| 255 | __audit_syscall_entry(major, a0, a1, a2, a3); | 260 | __audit_syscall_entry(major, a0, a1, a2, a3); |
| 256 | } | 261 | } |
| 257 | static inline void audit_syscall_exit(void *pt_regs) | 262 | static inline void audit_syscall_exit(void *pt_regs) |
| 258 | { | 263 | { |
| 259 | if (unlikely(current->audit_context)) { | 264 | if (unlikely(audit_context())) { |
| 260 | int success = is_syscall_success(pt_regs); | 265 | int success = is_syscall_success(pt_regs); |
| 261 | long return_code = regs_return_value(pt_regs); | 266 | long return_code = regs_return_value(pt_regs); |
| 262 | 267 | ||
| @@ -464,6 +469,10 @@ static inline bool audit_dummy_context(void) | |||
| 464 | { | 469 | { |
| 465 | return true; | 470 | return true; |
| 466 | } | 471 | } |
| 472 | static inline struct audit_context *audit_context(void) | ||
| 473 | { | ||
| 474 | return NULL; | ||
| 475 | } | ||
| 467 | static inline struct filename *audit_reusename(const __user char *name) | 476 | static inline struct filename *audit_reusename(const __user char *name) |
| 468 | { | 477 | { |
| 469 | return NULL; | 478 | return NULL; |
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index fcce8eef6c70..7f2e31aa3d65 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
| @@ -736,7 +736,7 @@ static inline struct audit_buffer *xfrm_audit_start(const char *op) | |||
| 736 | 736 | ||
| 737 | if (audit_enabled == 0) | 737 | if (audit_enabled == 0) |
| 738 | return NULL; | 738 | return NULL; |
| 739 | audit_buf = audit_log_start(current->audit_context, GFP_ATOMIC, | 739 | audit_buf = audit_log_start(audit_context(), GFP_ATOMIC, |
| 740 | AUDIT_MAC_IPSEC_EVENT); | 740 | AUDIT_MAC_IPSEC_EVENT); |
| 741 | if (audit_buf == NULL) | 741 | if (audit_buf == NULL) |
| 742 | return NULL; | 742 | return NULL; |
diff --git a/kernel/audit.c b/kernel/audit.c index e9f9a90790e5..e7478cb58079 100644 --- a/kernel/audit.c +++ b/kernel/audit.c | |||
| @@ -1099,8 +1099,7 @@ static void audit_log_feature_change(int which, u32 old_feature, u32 new_feature | |||
| 1099 | 1099 | ||
| 1100 | if (audit_enabled == AUDIT_OFF) | 1100 | if (audit_enabled == AUDIT_OFF) |
| 1101 | return; | 1101 | return; |
| 1102 | ab = audit_log_start(current->audit_context, | 1102 | ab = audit_log_start(audit_context(), GFP_KERNEL, AUDIT_FEATURE_CHANGE); |
| 1103 | GFP_KERNEL, AUDIT_FEATURE_CHANGE); | ||
| 1104 | if (!ab) | 1103 | if (!ab) |
| 1105 | return; | 1104 | return; |
| 1106 | audit_log_task_info(ab, current); | 1105 | audit_log_task_info(ab, current); |
| @@ -2317,8 +2316,7 @@ void audit_log_link_denied(const char *operation) | |||
| 2317 | return; | 2316 | return; |
| 2318 | 2317 | ||
| 2319 | /* Generate AUDIT_ANOM_LINK with subject, operation, outcome. */ | 2318 | /* Generate AUDIT_ANOM_LINK with subject, operation, outcome. */ |
| 2320 | ab = audit_log_start(current->audit_context, GFP_KERNEL, | 2319 | ab = audit_log_start(audit_context(), GFP_KERNEL, AUDIT_ANOM_LINK); |
| 2321 | AUDIT_ANOM_LINK); | ||
| 2322 | if (!ab) | 2320 | if (!ab) |
| 2323 | return; | 2321 | return; |
| 2324 | audit_log_format(ab, "op=%s", operation); | 2322 | audit_log_format(ab, "op=%s", operation); |
diff --git a/kernel/audit_watch.c b/kernel/audit_watch.c index 9eb8b3511636..f1ba88994508 100644 --- a/kernel/audit_watch.c +++ b/kernel/audit_watch.c | |||
| @@ -274,7 +274,7 @@ static void audit_update_watch(struct audit_parent *parent, | |||
| 274 | /* If the update involves invalidating rules, do the inode-based | 274 | /* If the update involves invalidating rules, do the inode-based |
| 275 | * filtering now, so we don't omit records. */ | 275 | * filtering now, so we don't omit records. */ |
| 276 | if (invalidating && !audit_dummy_context()) | 276 | if (invalidating && !audit_dummy_context()) |
| 277 | audit_filter_inodes(current, current->audit_context); | 277 | audit_filter_inodes(current, audit_context()); |
| 278 | 278 | ||
| 279 | /* updating ino will likely change which audit_hash_list we | 279 | /* updating ino will likely change which audit_hash_list we |
| 280 | * are on so we need a new watch for the new list */ | 280 | * are on so we need a new watch for the new list */ |
diff --git a/kernel/auditsc.c b/kernel/auditsc.c index 378c45b92775..fce4acba576d 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c | |||
| @@ -1509,8 +1509,7 @@ void __audit_free(struct task_struct *tsk) | |||
| 1509 | void __audit_syscall_entry(int major, unsigned long a1, unsigned long a2, | 1509 | void __audit_syscall_entry(int major, unsigned long a1, unsigned long a2, |
| 1510 | unsigned long a3, unsigned long a4) | 1510 | unsigned long a3, unsigned long a4) |
| 1511 | { | 1511 | { |
| 1512 | struct task_struct *tsk = current; | 1512 | struct audit_context *context = audit_context(); |
| 1513 | struct audit_context *context = tsk->audit_context; | ||
| 1514 | enum audit_state state; | 1513 | enum audit_state state; |
| 1515 | 1514 | ||
| 1516 | if (!audit_enabled || !context) | 1515 | if (!audit_enabled || !context) |
| @@ -1525,7 +1524,7 @@ void __audit_syscall_entry(int major, unsigned long a1, unsigned long a2, | |||
| 1525 | context->dummy = !audit_n_rules; | 1524 | context->dummy = !audit_n_rules; |
| 1526 | if (!context->dummy && state == AUDIT_BUILD_CONTEXT) { | 1525 | if (!context->dummy && state == AUDIT_BUILD_CONTEXT) { |
| 1527 | context->prio = 0; | 1526 | context->prio = 0; |
| 1528 | if (auditd_test_task(tsk)) | 1527 | if (auditd_test_task(current)) |
| 1529 | return; | 1528 | return; |
| 1530 | } | 1529 | } |
| 1531 | 1530 | ||
| @@ -1563,12 +1562,12 @@ void __audit_syscall_exit(int success, long return_code) | |||
| 1563 | else | 1562 | else |
| 1564 | success = AUDITSC_FAILURE; | 1563 | success = AUDITSC_FAILURE; |
| 1565 | 1564 | ||
| 1566 | context = audit_take_context(tsk, success, return_code); | 1565 | context = audit_take_context(current, success, return_code); |
| 1567 | if (!context) | 1566 | if (!context) |
| 1568 | return; | 1567 | return; |
| 1569 | 1568 | ||
| 1570 | if (context->in_syscall && context->current_state == AUDIT_RECORD_CONTEXT) | 1569 | if (context->in_syscall && context->current_state == AUDIT_RECORD_CONTEXT) |
| 1571 | audit_log_exit(context, tsk); | 1570 | audit_log_exit(context, current); |
| 1572 | 1571 | ||
| 1573 | context->in_syscall = 0; | 1572 | context->in_syscall = 0; |
| 1574 | context->prio = context->state == AUDIT_RECORD_CONTEXT ? ~0ULL : 0; | 1573 | context->prio = context->state == AUDIT_RECORD_CONTEXT ? ~0ULL : 0; |
| @@ -1602,7 +1601,7 @@ static inline void handle_one(const struct inode *inode) | |||
| 1602 | int count; | 1601 | int count; |
| 1603 | if (likely(!inode->i_fsnotify_marks)) | 1602 | if (likely(!inode->i_fsnotify_marks)) |
| 1604 | return; | 1603 | return; |
| 1605 | context = current->audit_context; | 1604 | context = audit_context(); |
| 1606 | p = context->trees; | 1605 | p = context->trees; |
| 1607 | count = context->tree_count; | 1606 | count = context->tree_count; |
| 1608 | rcu_read_lock(); | 1607 | rcu_read_lock(); |
| @@ -1633,7 +1632,7 @@ static void handle_path(const struct dentry *dentry) | |||
| 1633 | unsigned long seq; | 1632 | unsigned long seq; |
| 1634 | int count; | 1633 | int count; |
| 1635 | 1634 | ||
| 1636 | context = current->audit_context; | 1635 | context = audit_context(); |
| 1637 | p = context->trees; | 1636 | p = context->trees; |
| 1638 | count = context->tree_count; | 1637 | count = context->tree_count; |
| 1639 | retry: | 1638 | retry: |
| @@ -1715,7 +1714,7 @@ static struct audit_names *audit_alloc_name(struct audit_context *context, | |||
| 1715 | struct filename * | 1714 | struct filename * |
| 1716 | __audit_reusename(const __user char *uptr) | 1715 | __audit_reusename(const __user char *uptr) |
| 1717 | { | 1716 | { |
| 1718 | struct audit_context *context = current->audit_context; | 1717 | struct audit_context *context = audit_context(); |
| 1719 | struct audit_names *n; | 1718 | struct audit_names *n; |
| 1720 | 1719 | ||
| 1721 | list_for_each_entry(n, &context->names_list, list) { | 1720 | list_for_each_entry(n, &context->names_list, list) { |
| @@ -1738,7 +1737,7 @@ __audit_reusename(const __user char *uptr) | |||
| 1738 | */ | 1737 | */ |
| 1739 | void __audit_getname(struct filename *name) | 1738 | void __audit_getname(struct filename *name) |
| 1740 | { | 1739 | { |
| 1741 | struct audit_context *context = current->audit_context; | 1740 | struct audit_context *context = audit_context(); |
| 1742 | struct audit_names *n; | 1741 | struct audit_names *n; |
| 1743 | |||
