diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-17 21:48:49 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-17 21:48:49 -0500 |
| commit | 2d663b55816e5c1d211a77fff90687053fe78aac (patch) | |
| tree | f74a6d3ce5c8b28a22b571dd5b4400f75317e9c5 /kernel | |
| parent | 25eedabe019851bc513abd601ed514df524cb482 (diff) | |
| parent | cb74ed278f8054fddf79ed930495b9e214f7c7b2 (diff) | |
Merge branch 'upstream' of git://git.infradead.org/users/pcmoore/audit
Pull audit updates from Paul Moore:
"Seven audit patches for 4.5, all very minor despite the diffstat.
The diffstat churn for linux/audit.h can be attributed to needing to
reshuffle the linux/audit.h header to fix the seccomp auditing issue
(see the commit description for details).
Besides the seccomp/audit fix, most of the fixes are around trying to
improve the connection with the audit daemon and a Kconfig
simplification. Nothing crazy, and everything passes our little
audit-testsuite"
* 'upstream' of git://git.infradead.org/users/pcmoore/audit:
audit: always enable syscall auditing when supported and audit is enabled
audit: force seccomp event logging to honor the audit_enabled flag
audit: Delete unnecessary checks before two function calls
audit: wake up threads if queue switched from limited to unlimited
audit: include auditd's threads in audit_log_start() wait exception
audit: remove audit_backlog_wait_overflow
audit: don't needlessly reset valid wait time
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/audit.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/kernel/audit.c b/kernel/audit.c index 5ffcbd354a52..d6dd95cc59e6 100644 --- a/kernel/audit.c +++ b/kernel/audit.c | |||
| @@ -110,7 +110,6 @@ static u32 audit_backlog_limit = 64; | |||
| 110 | #define AUDIT_BACKLOG_WAIT_TIME (60 * HZ) | 110 | #define AUDIT_BACKLOG_WAIT_TIME (60 * HZ) |
| 111 | static u32 audit_backlog_wait_time_master = AUDIT_BACKLOG_WAIT_TIME; | 111 | static u32 audit_backlog_wait_time_master = AUDIT_BACKLOG_WAIT_TIME; |
| 112 | static u32 audit_backlog_wait_time = AUDIT_BACKLOG_WAIT_TIME; | 112 | static u32 audit_backlog_wait_time = AUDIT_BACKLOG_WAIT_TIME; |
| 113 | static u32 audit_backlog_wait_overflow = 0; | ||
| 114 | 113 | ||
| 115 | /* The identity of the user shutting down the audit system. */ | 114 | /* The identity of the user shutting down the audit system. */ |
| 116 | kuid_t audit_sig_uid = INVALID_UID; | 115 | kuid_t audit_sig_uid = INVALID_UID; |
| @@ -509,8 +508,7 @@ static void flush_hold_queue(void) | |||
| 509 | * if auditd just disappeared but we | 508 | * if auditd just disappeared but we |
| 510 | * dequeued an skb we need to drop ref | 509 | * dequeued an skb we need to drop ref |
| 511 | */ | 510 | */ |
| 512 | if (skb) | 511 | consume_skb(skb); |
| 513 | consume_skb(skb); | ||
| 514 | } | 512 | } |
| 515 | 513 | ||
| 516 | static int kauditd_thread(void *dummy) | 514 | static int kauditd_thread(void *dummy) |
| @@ -524,7 +522,8 @@ static int kauditd_thread(void *dummy) | |||
| 524 | skb = skb_dequeue(&audit_skb_queue); | 522 | skb = skb_dequeue(&audit_skb_queue); |
| 525 | 523 | ||
| 526 | if (skb) { | 524 | if (skb) { |
| 527 | if (skb_queue_len(&audit_skb_queue) <= audit_backlog_limit) | 525 | if (!audit_backlog_limit || |
| 526 | (skb_queue_len(&audit_skb_queue) <= audit_backlog_limit)) | ||
| 528 | wake_up(&audit_backlog_wait); | 527 | wake_up(&audit_backlog_wait); |
| 529 | if (audit_pid) | 528 | if (audit_pid) |
| 530 | kauditd_send_skb(skb); | 529 | kauditd_send_skb(skb); |
| @@ -1232,9 +1231,7 @@ static void audit_buffer_free(struct audit_buffer *ab) | |||
| 1232 | if (!ab) | 1231 | if (!ab) |
| 1233 | return; | 1232 | return; |
| 1234 | 1233 | ||
| 1235 | if (ab->skb) | 1234 | kfree_skb(ab->skb); |
| 1236 | kfree_skb(ab->skb); | ||
| 1237 | |||
| 1238 | spin_lock_irqsave(&audit_freelist_lock, flags); | 1235 | spin_lock_irqsave(&audit_freelist_lock, flags); |
| 1239 | if (audit_freelist_count > AUDIT_MAXFREE) | 1236 | if (audit_freelist_count > AUDIT_MAXFREE) |
| 1240 | kfree(ab); | 1237 | kfree(ab); |
| @@ -1372,7 +1369,7 @@ struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask, | |||
| 1372 | return NULL; | 1369 | return NULL; |
| 1373 | 1370 | ||
| 1374 | if (gfp_mask & __GFP_DIRECT_RECLAIM) { | 1371 | if (gfp_mask & __GFP_DIRECT_RECLAIM) { |
| 1375 | if (audit_pid && audit_pid == current->pid) | 1372 | if (audit_pid && audit_pid == current->tgid) |
| 1376 | gfp_mask &= ~__GFP_DIRECT_RECLAIM; | 1373 | gfp_mask &= ~__GFP_DIRECT_RECLAIM; |
| 1377 | else | 1374 | else |
| 1378 | reserve = 0; | 1375 | reserve = 0; |
| @@ -1395,12 +1392,12 @@ struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask, | |||
| 1395 | skb_queue_len(&audit_skb_queue), | 1392 | skb_queue_len(&audit_skb_queue), |
| 1396 | audit_backlog_limit); | 1393 | audit_backlog_limit); |
| 1397 | audit_log_lost("backlog limit exceeded"); | 1394 | audit_log_lost("backlog limit exceeded"); |
| 1398 | audit_backlog_wait_time = audit_backlog_wait_overflow; | 1395 | audit_backlog_wait_time = 0; |
| 1399 | wake_up(&audit_backlog_wait); | 1396 | wake_up(&audit_backlog_wait); |
| 1400 | return NULL; | 1397 | return NULL; |
| 1401 | } | 1398 | } |
| 1402 | 1399 | ||
| 1403 | if (!reserve) | 1400 | if (!reserve && !audit_backlog_wait_time) |
| 1404 | audit_backlog_wait_time = audit_backlog_wait_time_master; | 1401 | audit_backlog_wait_time = audit_backlog_wait_time_master; |
| 1405 | 1402 | ||
| 1406 | ab = audit_buffer_alloc(ctx, gfp_mask, type); | 1403 | ab = audit_buffer_alloc(ctx, gfp_mask, type); |
