mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
[PATCH] switch audit_get_loginuid() to task_struct *
all callers pass something->audit_context Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
24e1c13c93
commit
0c11b9428f
@ -105,8 +105,7 @@ static void tty_audit_buf_push(struct task_struct *tsk, uid_t loginuid,
|
|||||||
*/
|
*/
|
||||||
static void tty_audit_buf_push_current(struct tty_audit_buf *buf)
|
static void tty_audit_buf_push_current(struct tty_audit_buf *buf)
|
||||||
{
|
{
|
||||||
tty_audit_buf_push(current, audit_get_loginuid(current->audit_context),
|
tty_audit_buf_push(current, audit_get_loginuid(current), buf);
|
||||||
buf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -984,7 +984,7 @@ static ssize_t proc_loginuid_read(struct file * file, char __user * buf,
|
|||||||
if (!task)
|
if (!task)
|
||||||
return -ESRCH;
|
return -ESRCH;
|
||||||
length = scnprintf(tmpbuf, TMPBUFLEN, "%u",
|
length = scnprintf(tmpbuf, TMPBUFLEN, "%u",
|
||||||
audit_get_loginuid(task->audit_context));
|
audit_get_loginuid(task));
|
||||||
put_task_struct(task);
|
put_task_struct(task);
|
||||||
return simple_read_from_buffer(buf, count, ppos, tmpbuf, length);
|
return simple_read_from_buffer(buf, count, ppos, tmpbuf, length);
|
||||||
}
|
}
|
||||||
|
@ -409,7 +409,7 @@ extern unsigned int audit_serial(void);
|
|||||||
extern void auditsc_get_stamp(struct audit_context *ctx,
|
extern void auditsc_get_stamp(struct audit_context *ctx,
|
||||||
struct timespec *t, unsigned int *serial);
|
struct timespec *t, unsigned int *serial);
|
||||||
extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid);
|
extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid);
|
||||||
extern uid_t audit_get_loginuid(struct audit_context *ctx);
|
extern uid_t audit_get_loginuid(struct task_struct *task);
|
||||||
extern void audit_log_task_context(struct audit_buffer *ab);
|
extern void audit_log_task_context(struct audit_buffer *ab);
|
||||||
extern int __audit_ipc_obj(struct kern_ipc_perm *ipcp);
|
extern int __audit_ipc_obj(struct kern_ipc_perm *ipcp);
|
||||||
extern int __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode);
|
extern int __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode);
|
||||||
@ -488,7 +488,7 @@ extern int audit_signals;
|
|||||||
#define audit_inode_child(d,i,p) do { ; } while (0)
|
#define audit_inode_child(d,i,p) do { ; } while (0)
|
||||||
#define audit_core_dumps(i) do { ; } while (0)
|
#define audit_core_dumps(i) do { ; } while (0)
|
||||||
#define auditsc_get_stamp(c,t,s) do { BUG(); } while (0)
|
#define auditsc_get_stamp(c,t,s) do { BUG(); } while (0)
|
||||||
#define audit_get_loginuid(c) ({ -1; })
|
#define audit_get_loginuid(t) (-1)
|
||||||
#define audit_log_task_context(b) do { ; } while (0)
|
#define audit_log_task_context(b) do { ; } while (0)
|
||||||
#define audit_ipc_obj(i) ({ 0; })
|
#define audit_ipc_obj(i) ({ 0; })
|
||||||
#define audit_ipc_set_perm(q,u,g,m) ({ 0; })
|
#define audit_ipc_set_perm(q,u,g,m) ({ 0; })
|
||||||
|
@ -1804,8 +1804,9 @@ int audit_set_loginuid(struct task_struct *task, uid_t loginuid)
|
|||||||
*
|
*
|
||||||
* Returns the context's loginuid or -1 if @ctx is NULL.
|
* Returns the context's loginuid or -1 if @ctx is NULL.
|
||||||
*/
|
*/
|
||||||
uid_t audit_get_loginuid(struct audit_context *ctx)
|
uid_t audit_get_loginuid(struct task_struct *task)
|
||||||
{
|
{
|
||||||
|
struct audit_context *ctx = task->audit_context;
|
||||||
return ctx ? ctx->loginuid : -1;
|
return ctx ? ctx->loginuid : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2273,7 +2274,7 @@ void audit_core_dumps(long signr)
|
|||||||
|
|
||||||
ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_ANOM_ABEND);
|
ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_ANOM_ABEND);
|
||||||
audit_log_format(ab, "auid=%u uid=%u gid=%u",
|
audit_log_format(ab, "auid=%u uid=%u gid=%u",
|
||||||
audit_get_loginuid(current->audit_context),
|
audit_get_loginuid(current),
|
||||||
current->uid, current->gid);
|
current->uid, current->gid);
|
||||||
selinux_get_task_sid(current, &sid);
|
selinux_get_task_sid(current, &sid);
|
||||||
if (sid) {
|
if (sid) {
|
||||||
|
@ -2757,7 +2757,7 @@ static void __dev_set_promiscuity(struct net_device *dev, int inc)
|
|||||||
"dev=%s prom=%d old_prom=%d auid=%u",
|
"dev=%s prom=%d old_prom=%d auid=%u",
|
||||||
dev->name, (dev->flags & IFF_PROMISC),
|
dev->name, (dev->flags & IFF_PROMISC),
|
||||||
(old_flags & IFF_PROMISC),
|
(old_flags & IFF_PROMISC),
|
||||||
audit_get_loginuid(current->audit_context));
|
audit_get_loginuid(current));
|
||||||
|
|
||||||
if (dev->change_rx_flags)
|
if (dev->change_rx_flags)
|
||||||
dev->change_rx_flags(dev, IFF_PROMISC);
|
dev->change_rx_flags(dev, IFF_PROMISC);
|
||||||
|
@ -1466,7 +1466,7 @@ static int pfkey_add(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hdr,
|
|||||||
err = xfrm_state_update(x);
|
err = xfrm_state_update(x);
|
||||||
|
|
||||||
xfrm_audit_state_add(x, err ? 0 : 1,
|
xfrm_audit_state_add(x, err ? 0 : 1,
|
||||||
audit_get_loginuid(current->audit_context), 0);
|
audit_get_loginuid(current), 0);
|
||||||
|
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
x->km.state = XFRM_STATE_DEAD;
|
x->km.state = XFRM_STATE_DEAD;
|
||||||
@ -1520,7 +1520,7 @@ static int pfkey_delete(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h
|
|||||||
km_state_notify(x, &c);
|
km_state_notify(x, &c);
|
||||||
out:
|
out:
|
||||||
xfrm_audit_state_delete(x, err ? 0 : 1,
|
xfrm_audit_state_delete(x, err ? 0 : 1,
|
||||||
audit_get_loginuid(current->audit_context), 0);
|
audit_get_loginuid(current), 0);
|
||||||
xfrm_state_put(x);
|
xfrm_state_put(x);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
@ -1695,7 +1695,7 @@ static int pfkey_flush(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hd
|
|||||||
if (proto == 0)
|
if (proto == 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
audit_info.loginuid = audit_get_loginuid(current->audit_context);
|
audit_info.loginuid = audit_get_loginuid(current);
|
||||||
audit_info.secid = 0;
|
audit_info.secid = 0;
|
||||||
err = xfrm_state_flush(proto, &audit_info);
|
err = xfrm_state_flush(proto, &audit_info);
|
||||||
if (err)
|
if (err)
|
||||||
@ -2273,7 +2273,7 @@ static int pfkey_spdadd(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h
|
|||||||
hdr->sadb_msg_type != SADB_X_SPDUPDATE);
|
hdr->sadb_msg_type != SADB_X_SPDUPDATE);
|
||||||
|
|
||||||
xfrm_audit_policy_add(xp, err ? 0 : 1,
|
xfrm_audit_policy_add(xp, err ? 0 : 1,
|
||||||
audit_get_loginuid(current->audit_context), 0);
|
audit_get_loginuid(current), 0);
|
||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
goto out;
|
goto out;
|
||||||
@ -2356,7 +2356,7 @@ static int pfkey_spddelete(struct sock *sk, struct sk_buff *skb, struct sadb_msg
|
|||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
||||||
xfrm_audit_policy_delete(xp, err ? 0 : 1,
|
xfrm_audit_policy_delete(xp, err ? 0 : 1,
|
||||||
audit_get_loginuid(current->audit_context), 0);
|
audit_get_loginuid(current), 0);
|
||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
goto out;
|
goto out;
|
||||||
@ -2617,7 +2617,7 @@ static int pfkey_spdget(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h
|
|||||||
|
|
||||||
if (delete) {
|
if (delete) {
|
||||||
xfrm_audit_policy_delete(xp, err ? 0 : 1,
|
xfrm_audit_policy_delete(xp, err ? 0 : 1,
|
||||||
audit_get_loginuid(current->audit_context), 0);
|
audit_get_loginuid(current), 0);
|
||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
goto out;
|
goto out;
|
||||||
@ -2694,7 +2694,7 @@ static int pfkey_spdflush(struct sock *sk, struct sk_buff *skb, struct sadb_msg
|
|||||||
struct xfrm_audit audit_info;
|
struct xfrm_audit audit_info;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
audit_info.loginuid = audit_get_loginuid(current->audit_context);
|
audit_info.loginuid = audit_get_loginuid(current);
|
||||||
audit_info.secid = 0;
|
audit_info.secid = 0;
|
||||||
err = xfrm_policy_flush(XFRM_POLICY_TYPE_MAIN, &audit_info);
|
err = xfrm_policy_flush(XFRM_POLICY_TYPE_MAIN, &audit_info);
|
||||||
if (err)
|
if (err)
|
||||||
|
@ -1238,7 +1238,7 @@ static int netlink_sendmsg(struct kiocb *kiocb, struct socket *sock,
|
|||||||
|
|
||||||
NETLINK_CB(skb).pid = nlk->pid;
|
NETLINK_CB(skb).pid = nlk->pid;
|
||||||
NETLINK_CB(skb).dst_group = dst_group;
|
NETLINK_CB(skb).dst_group = dst_group;
|
||||||
NETLINK_CB(skb).loginuid = audit_get_loginuid(current->audit_context);
|
NETLINK_CB(skb).loginuid = audit_get_loginuid(current);
|
||||||
selinux_get_task_sid(current, &(NETLINK_CB(skb).sid));
|
selinux_get_task_sid(current, &(NETLINK_CB(skb).sid));
|
||||||
memcpy(NETLINK_CREDS(skb), &siocb->scm->creds, sizeof(struct ucred));
|
memcpy(NETLINK_CREDS(skb), &siocb->scm->creds, sizeof(struct ucred));
|
||||||
|
|
||||||
|
@ -493,7 +493,7 @@ expired:
|
|||||||
km_state_expired(x, 1, 0);
|
km_state_expired(x, 1, 0);
|
||||||
|
|
||||||
xfrm_audit_state_delete(x, err ? 0 : 1,
|
xfrm_audit_state_delete(x, err ? 0 : 1,
|
||||||
audit_get_loginuid(current->audit_context), 0);
|
audit_get_loginuid(current), 0);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
spin_unlock(&x->lock);
|
spin_unlock(&x->lock);
|
||||||
|
@ -174,7 +174,7 @@ static ssize_t sel_write_enforce(struct file * file, const char __user * buf,
|
|||||||
audit_log(current->audit_context, GFP_KERNEL, AUDIT_MAC_STATUS,
|
audit_log(current->audit_context, GFP_KERNEL, AUDIT_MAC_STATUS,
|
||||||
"enforcing=%d old_enforcing=%d auid=%u", new_value,
|
"enforcing=%d old_enforcing=%d auid=%u", new_value,
|
||||||
selinux_enforcing,
|
selinux_enforcing,
|
||||||
audit_get_loginuid(current->audit_context));
|
audit_get_loginuid(current));
|
||||||
selinux_enforcing = new_value;
|
selinux_enforcing = new_value;
|
||||||
if (selinux_enforcing)
|
if (selinux_enforcing)
|
||||||
avc_ss_reset(0);
|
avc_ss_reset(0);
|
||||||
@ -244,7 +244,7 @@ static ssize_t sel_write_disable(struct file * file, const char __user * buf,
|
|||||||
goto out;
|
goto out;
|
||||||
audit_log(current->audit_context, GFP_KERNEL, AUDIT_MAC_STATUS,
|
audit_log(current->audit_context, GFP_KERNEL, AUDIT_MAC_STATUS,
|
||||||
"selinux=0 auid=%u",
|
"selinux=0 auid=%u",
|
||||||
audit_get_loginuid(current->audit_context));
|
audit_get_loginuid(current));
|
||||||
}
|
}
|
||||||
|
|
||||||
length = count;
|
length = count;
|
||||||
@ -357,7 +357,7 @@ out1:
|
|||||||
|
|
||||||
audit_log(current->audit_context, GFP_KERNEL, AUDIT_MAC_POLICY_LOAD,
|
audit_log(current->audit_context, GFP_KERNEL, AUDIT_MAC_POLICY_LOAD,
|
||||||
"policy loaded auid=%u",
|
"policy loaded auid=%u",
|
||||||
audit_get_loginuid(current->audit_context));
|
audit_get_loginuid(current));
|
||||||
out:
|
out:
|
||||||
mutex_unlock(&sel_mutex);
|
mutex_unlock(&sel_mutex);
|
||||||
vfree(data);
|
vfree(data);
|
||||||
|
@ -1909,7 +1909,7 @@ int security_set_bools(int len, int *values)
|
|||||||
policydb.p_bool_val_to_name[i],
|
policydb.p_bool_val_to_name[i],
|
||||||
!!values[i],
|
!!values[i],
|
||||||
policydb.bool_val_to_struct[i]->state,
|
policydb.bool_val_to_struct[i]->state,
|
||||||
audit_get_loginuid(current->audit_context));
|
audit_get_loginuid(current));
|
||||||
}
|
}
|
||||||
if (values[i]) {
|
if (values[i]) {
|
||||||
policydb.bool_val_to_struct[i]->state = 1;
|
policydb.bool_val_to_struct[i]->state = 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user