aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-05-25 20:37:55 -0400
committerEric W. Biederman <ebiederm@xmission.com>2013-11-26 23:55:33 -0500
commit261000a56b6382f597bcb12000f55c9ff26a1efb (patch)
tree5280a6706c24fea298faf82526166c28f86dc1de
parent41301ae78a99ead04ea42672a1ab72c6f44cc81d (diff)
userns: userns: Remove UIDGID_STRICT_TYPE_CHECKS
Removing UIDGID_STRICT_TYPE_CHECKS simplifies the code and always generates a compile error if the uids and kuids or gids and kgids are mixed by accident. Now that the appropriate conversions have been placed throughout the kernel there is no longer a need for a mode where we don't detect them as compile errors. Acked-by: Serge Hallyn <serge.hallyn@canonical.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
-rw-r--r--include/linux/posix_acl.h3
-rw-r--r--include/linux/projid.h15
-rw-r--r--include/linux/uidgid.h22
-rw-r--r--init/Kconfig11
4 files changed, 0 insertions, 51 deletions
diff --git a/include/linux/posix_acl.h b/include/linux/posix_acl.h
index 7931efe71175..f0f7746b2359 100644
--- a/include/linux/posix_acl.h
+++ b/include/linux/posix_acl.h
@@ -39,9 +39,6 @@ struct posix_acl_entry {
39 union { 39 union {
40 kuid_t e_uid; 40 kuid_t e_uid;
41 kgid_t e_gid; 41 kgid_t e_gid;
42#ifndef CONFIG_UIDGID_STRICT_TYPE_CHECKS
43 unsigned int e_id;
44#endif
45 }; 42 };
46}; 43};
47 44
diff --git a/include/linux/projid.h b/include/linux/projid.h
index 36517b95be5c..8c1f2c55226d 100644
--- a/include/linux/projid.h
+++ b/include/linux/projid.h
@@ -18,8 +18,6 @@ extern struct user_namespace init_user_ns;
18 18
19typedef __kernel_uid32_t projid_t; 19typedef __kernel_uid32_t projid_t;
20 20
21#ifdef CONFIG_UIDGID_STRICT_TYPE_CHECKS
22
23typedef struct { 21typedef struct {
24 projid_t val; 22 projid_t val;
25} kprojid_t; 23} kprojid_t;
@@ -31,19 +29,6 @@ static inline projid_t __kprojid_val(kprojid_t projid)
31 29
32#define KPROJIDT_INIT(value) (kprojid_t){ value } 30#define KPROJIDT_INIT(value) (kprojid_t){ value }
33 31
34#else
35
36typedef projid_t kprojid_t;
37
38static inline projid_t __kprojid_val(kprojid_t projid)
39{
40 return projid;
41}
42
43#define KPROJIDT_INIT(value) ((kprojid_t) value )
44
45#endif
46
47#define INVALID_PROJID KPROJIDT_INIT(-1) 32#define INVALID_PROJID KPROJIDT_INIT(-1)
48#define OVERFLOW_PROJID 65534 33#define OVERFLOW_PROJID 65534
49 34
diff --git a/include/linux/uidgid.h b/include/linux/uidgid.h
index 8e522cbcef29..2d1f9b627f91 100644
--- a/include/linux/uidgid.h
+++ b/include/linux/uidgid.h
@@ -17,8 +17,6 @@
17struct user_namespace; 17struct user_namespace;
18extern struct user_namespace init_user_ns; 18extern struct user_namespace init_user_ns;
19 19
20#ifdef CONFIG_UIDGID_STRICT_TYPE_CHECKS
21
22typedef struct { 20typedef struct {
23 uid_t val; 21 uid_t val;
24} kuid_t; 22} kuid_t;
@@ -41,26 +39,6 @@ static inline gid_t __kgid_val(kgid_t gid)
41 return gid.val; 39 return gid.val;
42} 40}
43 41
44#else
45
46typedef uid_t kuid_t;
47typedef gid_t kgid_t;
48
49static inline uid_t __kuid_val(kuid_t uid)
50{
51 return uid;
52}
53
54static inline gid_t __kgid_val(kgid_t gid)
55{
56 return gid;
57}
58
59#define KUIDT_INIT(value) ((kuid_t) value )
60#define KGIDT_INIT(value) ((kgid_t) value )
61
62#endif
63
64#define GLOBAL_ROOT_UID KUIDT_INIT(0) 42#define GLOBAL_ROOT_UID KUIDT_INIT(0)
65#define GLOBAL_ROOT_GID KGIDT_INIT(0) 43#define GLOBAL_ROOT_GID KGIDT_INIT(0)
66 44
diff --git a/init/Kconfig b/init/Kconfig
index 79383d3aa5dc..d4eb994d1757 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1110,8 +1110,6 @@ config IPC_NS
1110 1110
1111config USER_NS 1111config USER_NS
1112 bool "User namespace" 1112 bool "User namespace"
1113 select UIDGID_STRICT_TYPE_CHECKS
1114
1115 default n 1113 default n
1116 help 1114 help
1117 This allows containers, i.e. vservers, to use user namespaces 1115 This allows containers, i.e. vservers, to use user namespaces
@@ -1143,15 +1141,6 @@ config NET_NS
1143 1141
1144endif # NAMESPACES 1142endif # NAMESPACES
1145 1143
1146config UIDGID_STRICT_TYPE_CHECKS
1147 bool "Require conversions between uid/gids and their internal representation"
1148 default n
1149 help
1150 While the nececessary conversions are being added to all subsystems this option allows
1151 the code to continue to build for unconverted subsystems.
1152
1153 Say Y here if you want the strict type checking enabled
1154
1155config SCHED_AUTOGROUP 1144config SCHED_AUTOGROUP
1156 bool "Automatic process group scheduling" 1145 bool "Automatic process group scheduling"
1157 select EVENTFD 1146 select EVENTFD