aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/audit.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/audit.c')
-rw-r--r--kernel/audit.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/kernel/audit.c b/kernel/audit.c
index 9060be750c48..7ec9ccae1299 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -390,7 +390,7 @@ static int audit_netlink_ok(kernel_cap_t eff_cap, u16 msg_type)
390 390
391static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) 391static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
392{ 392{
393 u32 uid, pid, seq; 393 u32 uid, pid, seq, sid;
394 void *data; 394 void *data;
395 struct audit_status *status_get, status_set; 395 struct audit_status *status_get, status_set;
396 int err; 396 int err;
@@ -416,6 +416,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
416 pid = NETLINK_CREDS(skb)->pid; 416 pid = NETLINK_CREDS(skb)->pid;
417 uid = NETLINK_CREDS(skb)->uid; 417 uid = NETLINK_CREDS(skb)->uid;
418 loginuid = NETLINK_CB(skb).loginuid; 418 loginuid = NETLINK_CB(skb).loginuid;
419 sid = NETLINK_CB(skb).sid;
419 seq = nlh->nlmsg_seq; 420 seq = nlh->nlmsg_seq;
420 data = NLMSG_DATA(nlh); 421 data = NLMSG_DATA(nlh);
421 422
@@ -468,8 +469,23 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
468 ab = audit_log_start(NULL, GFP_KERNEL, msg_type); 469 ab = audit_log_start(NULL, GFP_KERNEL, msg_type);
469 if (ab) { 470 if (ab) {
470 audit_log_format(ab, 471 audit_log_format(ab,
471 "user pid=%d uid=%u auid=%u msg='%.1024s'", 472 "user pid=%d uid=%u auid=%u",
472 pid, uid, loginuid, (char *)data); 473 pid, uid, loginuid);
474 if (sid) {
475 char *ctx = NULL;
476 u32 len;
477 if (selinux_ctxid_to_string(
478 sid, &ctx, &len)) {
479 audit_log_format(ab,
480 " subj=%u", sid);
481 /* Maybe call audit_panic? */
482 } else
483 audit_log_format(ab,
484 " subj=%s", ctx);
485 kfree(ctx);
486 }
487 audit_log_format(ab, " msg='%.1024s'",
488 (char *)data);
473 audit_set_pid(ab, pid); 489 audit_set_pid(ab, pid);
474 audit_log_end(ab); 490 audit_log_end(ab);
475 } 491 }