aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/xfrm.h
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-09-11 01:39:43 -0400
committerEric W. Biederman <ebiederm@xmission.com>2012-09-17 21:08:54 -0400
commite1760bd5ffae8cb98cffb030ee8e631eba28f3d8 (patch)
tree4694a60b407c418bf7de4b97355dc3bd0e6c6559 /include/net/xfrm.h
parentca57ec0f00c3f139c41bf6b0a5b9bcc95bbb2ad7 (diff)
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>
Diffstat (limited to 'include/net/xfrm.h')
-rw-r--r--include/net/xfrm.h23
1 files changed, 12 insertions, 11 deletions
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index d9509eb29b80..1f217e2c5d82 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -662,7 +662,7 @@ struct xfrm_spi_skb_cb {
662/* Audit Information */ 662/* Audit Information */
663struct xfrm_audit { 663struct xfrm_audit {
664 u32 secid; 664 u32 secid;
665 uid_t loginuid; 665 kuid_t loginuid;
666 u32 sessionid; 666 u32 sessionid;
667}; 667};
668 668
@@ -681,13 +681,14 @@ static inline struct audit_buffer *xfrm_audit_start(const char *op)
681 return audit_buf; 681 return audit_buf;
682} 682}
683 683
684static inline void xfrm_audit_helper_usrinfo(uid_t auid, u32 ses, u32 secid, 684static inline void xfrm_audit_helper_usrinfo(kuid_t auid, u32 ses, u32 secid,
685 struct audit_buffer *audit_buf) 685 struct audit_buffer *audit_buf)
686{ 686{
687 char *secctx; 687 char *secctx;
688 u32 secctx_len; 688 u32 secctx_len;
689 689
690 audit_log_format(audit_buf, " auid=%u ses=%u", auid, ses); 690 audit_log_format(audit_buf, " auid=%u ses=%u",
691 from_kuid(&init_user_ns, auid), ses);
691 if (secid != 0 && 692 if (secid != 0 &&
692 security_secid_to_secctx(secid, &secctx, &secctx_len) == 0) { 693 security_secid_to_secctx(secid, &secctx, &secctx_len) == 0) {
693 audit_log_format(audit_buf, " subj=%s", secctx); 694 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,
697} 698}
698 699
699extern void xfrm_audit_policy_add(struct xfrm_policy *xp, int result, 700extern void xfrm_audit_policy_add(struct xfrm_policy *xp, int result,
700 u32 auid, u32 ses, u32 secid); 701 kuid_t auid, u32 ses, u32 secid);
701extern void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result, 702extern void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result,
702 u32 auid, u32 ses, u32 secid); 703 kuid_t auid, u32 ses, u32 secid);
703extern void xfrm_audit_state_add(struct xfrm_state *x, int result, 704extern void xfrm_audit_state_add(struct xfrm_state *x, int result,
704 u32 auid, u32 ses, u32 secid); 705 kuid_t auid, u32 ses, u32 secid);
705extern void xfrm_audit_state_delete(struct xfrm_state *x, int result, 706extern void xfrm_audit_state_delete(struct xfrm_state *x, int result,
706 u32 auid, u32 ses, u32 secid); 707 kuid_t auid, u32 ses, u32 secid);
707extern void xfrm_audit_state_replay_overflow(struct xfrm_state *x, 708extern void xfrm_audit_state_replay_overflow(struct xfrm_state *x,
708 struct sk_buff *skb); 709 struct sk_buff *skb);
709extern void xfrm_audit_state_replay(struct xfrm_state *x, 710extern void xfrm_audit_state_replay(struct xfrm_state *x,
@@ -716,22 +717,22 @@ extern void xfrm_audit_state_icvfail(struct xfrm_state *x,
716#else 717#else
717 718
718static inline void xfrm_audit_policy_add(struct xfrm_policy *xp, int result, 719static inline void xfrm_audit_policy_add(struct xfrm_policy *xp, int result,
719 u32 auid, u32 ses, u32 secid) 720 kuid_t auid, u32 ses, u32 secid)
720{ 721{
721} 722}
722 723
723static inline void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result, 724static inline void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result,
724 u32 auid, u32 ses, u32 secid) 725 kuid_t auid, u32 ses, u32 secid)
725{ 726{
726} 727}
727 728
728static inline void xfrm_audit_state_add(struct xfrm_state *x, int result, 729static inline void xfrm_audit_state_add(struct xfrm_state *x, int result,
729 u32 auid, u32 ses, u32 secid) 730 kuid_t auid, u32 ses, u32 secid)
730{ 731{
731} 732}
732 733
733static inline void xfrm_audit_state_delete(struct xfrm_state *x, int result, 734static inline void xfrm_audit_state_delete(struct xfrm_state *x, int result,
734 u32 auid, u32 ses, u32 secid) 735 kuid_t auid, u32 ses, u32 secid)
735{ 736{
736} 737}
737 738