aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/xfrm.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-02 14:11:09 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-02 14:11:09 -0400
commit437589a74b6a590d175f86cf9f7b2efcee7765e7 (patch)
tree37bf8635b1356d80ef002b00e84f3faf3d555a63 /include/net/xfrm.h
parent68d47a137c3bef754923bccf73fb639c9b0bbd5e (diff)
parent72235465864d84cedb2d9f26f8e1de824ee20339 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace
Pull user namespace changes from Eric Biederman: "This is a mostly modest set of changes to enable basic user namespace support. This allows the code to code to compile with user namespaces enabled and removes the assumption there is only the initial user namespace. Everything is converted except for the most complex of the filesystems: autofs4, 9p, afs, ceph, cifs, coda, fuse, gfs2, ncpfs, nfs, ocfs2 and xfs as those patches need a bit more review. The strategy is to push kuid_t and kgid_t values are far down into subsystems and filesystems as reasonable. Leaving the make_kuid and from_kuid operations to happen at the edge of userspace, as the values come off the disk, and as the values come in from the network. Letting compile type incompatible compile errors (present when user namespaces are enabled) guide me to find the issues. The most tricky areas have been the places where we had an implicit union of uid and gid values and were storing them in an unsigned int. Those places were converted into explicit unions. I made certain to handle those places with simple trivial patches. Out of that work I discovered we have generic interfaces for storing quota by projid. I had never heard of the project identifiers before. Adding full user namespace support for project identifiers accounts for most of the code size growth in my git tree. Ultimately there will be work to relax privlige checks from "capable(FOO)" to "ns_capable(user_ns, FOO)" where it is safe allowing root in a user names to do those things that today we only forbid to non-root users because it will confuse suid root applications. While I was pushing kuid_t and kgid_t changes deep into the audit code I made a few other cleanups. I capitalized on the fact we process netlink messages in the context of the message sender. I removed usage of NETLINK_CRED, and started directly using current->tty. Some of these patches have also made it into maintainer trees, with no problems from identical code from different trees showing up in linux-next. After reading through all of this code I feel like I might be able to win a game of kernel trivial pursuit." Fix up some fairly trivial conflicts in netfilter uid/git logging code. * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace: (107 commits) userns: Convert the ufs filesystem to use kuid/kgid where appropriate userns: Convert the udf filesystem to use kuid/kgid where appropriate userns: Convert ubifs to use kuid/kgid userns: Convert squashfs to use kuid/kgid where appropriate userns: Convert reiserfs to use kuid and kgid where appropriate userns: Convert jfs to use kuid/kgid where appropriate userns: Convert jffs2 to use kuid and kgid where appropriate userns: Convert hpfs to use kuid and kgid where appropriate userns: Convert btrfs to use kuid/kgid where appropriate userns: Convert bfs to use kuid/kgid where appropriate userns: Convert affs to use kuid/kgid wherwe appropriate userns: On alpha modify linux_to_osf_stat to use convert from kuids and kgids userns: On ia64 deal with current_uid and current_gid being kuid and kgid userns: On ppc convert current_uid from a kuid before printing. userns: Convert s390 getting uid and gid system calls to use kuid and kgid userns: Convert s390 hypfs to use kuid and kgid where appropriate userns: Convert binder ipc to use kuids userns: Teach security_path_chown to take kuids and kgids userns: Add user namespace support to IMA userns: Convert EVM to deal with kuids and kgids in it's hmac computation ...
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 639dd1316d37..411d83c9821d 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -671,7 +671,7 @@ struct xfrm_spi_skb_cb {
671/* Audit Information */ 671/* Audit Information */
672struct xfrm_audit { 672struct xfrm_audit {
673 u32 secid; 673 u32 secid;
674 uid_t loginuid; 674 kuid_t loginuid;
675 u32 sessionid; 675 u32 sessionid;
676}; 676};
677 677
@@ -690,13 +690,14 @@ static inline struct audit_buffer *xfrm_audit_start(const char *op)
690 return audit_buf; 690 return audit_buf;
691} 691}
692 692
693static inline void xfrm_audit_helper_usrinfo(uid_t auid, u32 ses, u32 secid, 693static inline void xfrm_audit_helper_usrinfo(kuid_t auid, u32 ses, u32 secid,
694 struct audit_buffer *audit_buf) 694 struct audit_buffer *audit_buf)
695{ 695{
696 char *secctx; 696 char *secctx;
697 u32 secctx_len; 697 u32 secctx_len;
698 698
699 audit_log_format(audit_buf, " auid=%u ses=%u", auid, ses); 699 audit_log_format(audit_buf, " auid=%u ses=%u",
700 from_kuid(&init_user_ns, auid), ses);
700 if (secid != 0 && 701 if (secid != 0 &&
701 security_secid_to_secctx(secid, &secctx, &secctx_len) == 0) { 702 security_secid_to_secctx(secid, &secctx, &secctx_len) == 0) {
702 audit_log_format(audit_buf, " subj=%s", secctx); 703 audit_log_format(audit_buf, " subj=%s", secctx);
@@ -706,13 +707,13 @@ static inline void xfrm_audit_helper_usrinfo(uid_t auid, u32 ses, u32 secid,
706} 707}
707 708
708extern void xfrm_audit_policy_add(struct xfrm_policy *xp, int result, 709extern void xfrm_audit_policy_add(struct xfrm_policy *xp, int result,
709 u32 auid, u32 ses, u32 secid); 710 kuid_t auid, u32 ses, u32 secid);
710extern void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result, 711extern void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result,
711 u32 auid, u32 ses, u32 secid); 712 kuid_t auid, u32 ses, u32 secid);
712extern void xfrm_audit_state_add(struct xfrm_state *x, int result, 713extern void xfrm_audit_state_add(struct xfrm_state *x, int result,
713 u32 auid, u32 ses, u32 secid); 714 kuid_t auid, u32 ses, u32 secid);
714extern void xfrm_audit_state_delete(struct xfrm_state *x, int result, 715extern void xfrm_audit_state_delete(struct xfrm_state *x, int result,
715 u32 auid, u32 ses, u32 secid); 716 kuid_t auid, u32 ses, u32 secid);
716extern void xfrm_audit_state_replay_overflow(struct xfrm_state *x, 717extern void xfrm_audit_state_replay_overflow(struct xfrm_state *x,
717 struct sk_buff *skb); 718 struct sk_buff *skb);
718extern void xfrm_audit_state_replay(struct xfrm_state *x, 719extern void xfrm_audit_state_replay(struct xfrm_state *x,
@@ -725,22 +726,22 @@ extern void xfrm_audit_state_icvfail(struct xfrm_state *x,
725#else 726#else
726 727
727static inline void xfrm_audit_policy_add(struct xfrm_policy *xp, int result, 728static inline void xfrm_audit_policy_add(struct xfrm_policy *xp, int result,
728 u32 auid, u32 ses, u32 secid) 729 kuid_t auid, u32 ses, u32 secid)
729{ 730{
730} 731}
731 732
732static inline void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result, 733static inline void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result,
733 u32 auid, u32 ses, u32 secid) 734 kuid_t auid, u32 ses, u32 secid)
734{ 735{
735} 736}
736 737
737static inline void xfrm_audit_state_add(struct xfrm_state *x, int result, 738static inline void xfrm_audit_state_add(struct xfrm_state *x, int result,
738 u32 auid, u32 ses, u32 secid) 739 kuid_t auid, u32 ses, u32 secid)
739{ 740{
740} 741}
741 742
742static inline void xfrm_audit_state_delete(struct xfrm_state *x, int result, 743static inline void xfrm_audit_state_delete(struct xfrm_state *x, int result,
743 u32 auid, u32 ses, u32 secid) 744 kuid_t auid, u32 ses, u32 secid)
744{ 745{
745} 746}
746 747