aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/auditsc.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/auditsc.c')
-rw-r--r--kernel/auditsc.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 3229cd4206f5..cef34235b362 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -204,6 +204,12 @@ struct audit_aux_data_bprm_fcaps {
204 struct audit_cap_data new_pcap; 204 struct audit_cap_data new_pcap;
205}; 205};
206 206
207struct audit_aux_data_capset {
208 struct audit_aux_data d;
209 pid_t pid;
210 struct audit_cap_data cap;
211};
212
207struct audit_tree_refs { 213struct audit_tree_refs {
208 struct audit_tree_refs *next; 214 struct audit_tree_refs *next;
209 struct audit_chunk *c[31]; 215 struct audit_chunk *c[31];
@@ -1397,6 +1403,14 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts
1397 audit_log_cap(ab, "new_pe", &axs->new_pcap.effective); 1403 audit_log_cap(ab, "new_pe", &axs->new_pcap.effective);
1398 break; } 1404 break; }
1399 1405
1406 case AUDIT_CAPSET: {
1407 struct audit_aux_data_capset *axs = (void *)aux;
1408 audit_log_format(ab, "pid=%d", axs->pid);
1409 audit_log_cap(ab, "cap_pi", &axs->cap.inheritable);
1410 audit_log_cap(ab, "cap_pp", &axs->cap.permitted);
1411 audit_log_cap(ab, "cap_pe", &axs->cap.effective);
1412 break; }
1413
1400 } 1414 }
1401 audit_log_end(ab); 1415 audit_log_end(ab);
1402 } 1416 }
@@ -2570,6 +2584,40 @@ void __audit_log_bprm_fcaps(struct linux_binprm *bprm, kernel_cap_t *pP, kernel_
2570} 2584}
2571 2585
2572/** 2586/**
2587 * __audit_log_capset - store information about the arguments to the capset syscall
2588 * @pid target pid of the capset call
2589 * @eff effective cap set
2590 * @inh inheritible cap set
2591 * @perm permited cap set
2592 *
2593 * Record the aguments userspace sent to sys_capset for later printing by the
2594 * audit system if applicable
2595 */
2596int __audit_log_capset(pid_t pid, kernel_cap_t *eff, kernel_cap_t *inh, kernel_cap_t *perm)
2597{
2598 struct audit_aux_data_capset *ax;
2599 struct audit_context *context = current->audit_context;
2600
2601 if (likely(!audit_enabled || !context || context->dummy))
2602 return 0;
2603
2604 ax = kmalloc(sizeof(*ax), GFP_KERNEL);
2605 if (!ax)
2606 return -ENOMEM;
2607
2608 ax->d.type = AUDIT_CAPSET;
2609 ax->d.next = context->aux;
2610 context->aux = (void *)ax;
2611
2612 ax->pid = pid;
2613 ax->cap.effective = *eff;
2614 ax->cap.inheritable = *eff;
2615 ax->cap.permitted = *perm;
2616
2617 return 0;
2618}
2619
2620/**
2573 * audit_core_dumps - record information about processes that end abnormally 2621 * audit_core_dumps - record information about processes that end abnormally
2574 * @signr: signal value 2622 * @signr: signal value
2575 * 2623 *