mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-25 06:03:36 -04:00
userns: Convert the audit loginuid to be a kuid
Always store audit loginuids in type kuid_t. Print loginuids by converting them into uids in the appropriate user namespace, and then printing the resulting uid. Modify audit_get_loginuid to return a kuid_t. Modify audit_set_loginuid to take a kuid_t. Modify /proc/<pid>/loginuid on read to convert the loginuid into the user namespace of the opener of the file. Modify /proc/<pid>/loginud on write to convert the loginuid rom the user namespace of the opener of the file. Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Eric Paris <eparis@redhat.com> Cc: Paul Moore <paul@paul-moore.com> ? Cc: David Miller <davem@davemloft.net> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
This commit is contained in:
parent
ca57ec0f00
commit
e1760bd5ff
18 changed files with 80 additions and 66 deletions
|
|
@ -110,7 +110,7 @@ struct cipso_v4_doi;
|
|||
/* NetLabel audit information */
|
||||
struct netlbl_audit {
|
||||
u32 secid;
|
||||
uid_t loginuid;
|
||||
kuid_t loginuid;
|
||||
u32 sessionid;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -662,7 +662,7 @@ struct xfrm_spi_skb_cb {
|
|||
/* Audit Information */
|
||||
struct xfrm_audit {
|
||||
u32 secid;
|
||||
uid_t loginuid;
|
||||
kuid_t loginuid;
|
||||
u32 sessionid;
|
||||
};
|
||||
|
||||
|
|
@ -681,13 +681,14 @@ static inline struct audit_buffer *xfrm_audit_start(const char *op)
|
|||
return audit_buf;
|
||||
}
|
||||
|
||||
static inline void xfrm_audit_helper_usrinfo(uid_t auid, u32 ses, u32 secid,
|
||||
static inline void xfrm_audit_helper_usrinfo(kuid_t auid, u32 ses, u32 secid,
|
||||
struct audit_buffer *audit_buf)
|
||||
{
|
||||
char *secctx;
|
||||
u32 secctx_len;
|
||||
|
||||
audit_log_format(audit_buf, " auid=%u ses=%u", auid, ses);
|
||||
audit_log_format(audit_buf, " auid=%u ses=%u",
|
||||
from_kuid(&init_user_ns, auid), ses);
|
||||
if (secid != 0 &&
|
||||
security_secid_to_secctx(secid, &secctx, &secctx_len) == 0) {
|
||||
audit_log_format(audit_buf, " subj=%s", secctx);
|
||||
|
|
@ -697,13 +698,13 @@ static inline void xfrm_audit_helper_usrinfo(uid_t auid, u32 ses, u32 secid,
|
|||
}
|
||||
|
||||
extern void xfrm_audit_policy_add(struct xfrm_policy *xp, int result,
|
||||
u32 auid, u32 ses, u32 secid);
|
||||
kuid_t auid, u32 ses, u32 secid);
|
||||
extern void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result,
|
||||
u32 auid, u32 ses, u32 secid);
|
||||
kuid_t auid, u32 ses, u32 secid);
|
||||
extern void xfrm_audit_state_add(struct xfrm_state *x, int result,
|
||||
u32 auid, u32 ses, u32 secid);
|
||||
kuid_t auid, u32 ses, u32 secid);
|
||||
extern void xfrm_audit_state_delete(struct xfrm_state *x, int result,
|
||||
u32 auid, u32 ses, u32 secid);
|
||||
kuid_t auid, u32 ses, u32 secid);
|
||||
extern void xfrm_audit_state_replay_overflow(struct xfrm_state *x,
|
||||
struct sk_buff *skb);
|
||||
extern void xfrm_audit_state_replay(struct xfrm_state *x,
|
||||
|
|
@ -716,22 +717,22 @@ extern void xfrm_audit_state_icvfail(struct xfrm_state *x,
|
|||
#else
|
||||
|
||||
static inline void xfrm_audit_policy_add(struct xfrm_policy *xp, int result,
|
||||
u32 auid, u32 ses, u32 secid)
|
||||
kuid_t auid, u32 ses, u32 secid)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result,
|
||||
u32 auid, u32 ses, u32 secid)
|
||||
kuid_t auid, u32 ses, u32 secid)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void xfrm_audit_state_add(struct xfrm_state *x, int result,
|
||||
u32 auid, u32 ses, u32 secid)
|
||||
kuid_t auid, u32 ses, u32 secid)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void xfrm_audit_state_delete(struct xfrm_state *x, int result,
|
||||
u32 auid, u32 ses, u32 secid)
|
||||
kuid_t auid, u32 ses, u32 secid)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue