make AUDIT_SIGNAL_INFO return string form of context
PATCH 2/4 make AUDIT_SIGNAL_INFO return string form of context
Incremental to returning sid in AUDIT_SIGNAL_INFO (and correcting it); will fold on next rebase.
Signed-off-by Al Viro <[email protected]>
---
include/linux/audit.h | 2 +- kernel/audit.c | 31 +++++++++++++++++++------------ 2 files changed, 20 insertions(+), 13 deletions(-)
419d00e6e54bfbcd91c2f72bb99d215ba45a717f
include/linux/audit.h +1 -1
@@ -280,7 +280,7 @@ #ifdef __KERNEL__struct audit_sig_info {uid_t uid;pid_t pid; -__u32 sid; +char ctx[0 ]; };struct audit_buffer ;
kernel/audit.c +19 -12
@@ -484,7 +484,9 @@ static int audit_receive_msg(struct sk_bstruct audit_buffer *ab;u16 msg_type = nlh->nlmsg_type;uid_t loginuid;/* loginuid of sender */ -struct audit_sig_info sig_data; +struct audit_sig_info *sig_data; +char *ctx; +u32 len; err =audit_netlink_ok (NETLINK_CB (skb).eff_cap, msg_type);if (err)
@@ -536,12 +538,9 @@ static int audit_receive_msg(struct sk_bif (status_get->mask &AUDIT_STATUS_PID ) {int old = audit_pid;if (sid) { -char *ctx =NULL ; -u32 len; -int rc; -if ((rc =selinux_ctxid_to_string ( +if ((err =selinux_ctxid_to_string ( sid, &ctx, &len))) -return rc; +return err;else audit_log(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE,
@@ -577,8 +576,6 @@ static int audit_receive_msg(struct sk_b"user pid=%d uid=%u auid=%u" , pid, uid, loginuid);if (sid) { -char *ctx =NULL ; -u32 len;if (selinux_ctxid_to_string ( sid, &ctx, &len)) { audit_log_format(ab,
@@ -617,11 +614,21 @@ static int audit_receive_msg(struct sk_b loginuid, sid);break ;case AUDIT_SIGNAL_INFO : - sig_data.uid = audit_sig_uid; - sig_data.pid = audit_sig_pid; - sig_data.sid = audit_sig_sid; + err =selinux_ctxid_to_string (audit_sig_sid, &ctx, &len); +if (err) +return err; + sig_data =kmalloc (sizeof (*sig_data) + len,GFP_KERNEL ); +if (!sig_data) { +kfree (ctx); +return -ENOMEM ; + } + sig_data->uid = audit_sig_uid; + sig_data->pid = audit_sig_pid; +memcpy (sig_data->ctx, ctx, len); +kfree (ctx);audit_send_reply (NETLINK_CB (skb).pid, seq,AUDIT_SIGNAL_INFO , -0 ,0 , &sig_data,sizeof (sig_data)); +0 ,0 , &sig_data,sizeof (*sig_data) + len); +kfree (sig_data);break ;default : err = -EINVAL ;
Signature · 1 line
1.3.GIT