aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2011-11-17 13:23:55 -0500
committerEric W. Biederman <ebiederm@xmission.com>2012-04-07 20:11:01 -0400
commit5673a94c14574d7c6495c320c6b0e480673d54bd (patch)
treebb715a6551732475aaa6870f08da8d49529ee82d
parent7a4e7408c5cadb240e068a662251754a562355e3 (diff)
userns: Add a Kconfig option to enforce strict kuid and kgid type checks
Make it possible to easily switch between strong mandatory type checks and relaxed type checks so that the code can easily be tested with the type checks and then built with the strong type checks disabled so the resulting code can be used. Require strong mandatory type checks when enabling the user namespace. It is very simple to make a typo and use the wrong type allowing conversions to/from userspace values to be bypassed by accident, the strong type checks prevent this. Acked-by: Serge Hallyn <serge.hallyn@canonical.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
-rw-r--r--include/linux/uidgid.h2
-rw-r--r--init/Kconfig12
2 files changed, 12 insertions, 2 deletions
diff --git a/include/linux/uidgid.h b/include/linux/uidgid.h
index a0addb8e5889..539856829caf 100644
--- a/include/linux/uidgid.h
+++ b/include/linux/uidgid.h
@@ -17,7 +17,7 @@
17struct user_namespace; 17struct user_namespace;
18extern struct user_namespace init_user_ns; 18extern struct user_namespace init_user_ns;
19 19
20#if defined(NOTYET) 20#ifdef CONFIG_UIDGID_STRICT_TYPE_CHECKS
21 21
22typedef struct { 22typedef struct {
23 uid_t val; 23 uid_t val;
diff --git a/init/Kconfig b/init/Kconfig
index 72f33faca44f..86cf760893b3 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -828,7 +828,8 @@ config IPC_NS
828config USER_NS 828config USER_NS
829 bool "User namespace (EXPERIMENTAL)" 829 bool "User namespace (EXPERIMENTAL)"
830 depends on EXPERIMENTAL 830 depends on EXPERIMENTAL
831 default y 831 select UIDGID_STRICT_TYPE_CHECKS
832 default n
832 help 833 help
833 This allows containers, i.e. vservers, to use user namespaces 834 This allows containers, i.e. vservers, to use user namespaces
834 to provide different user info for different servers. 835 to provide different user info for different servers.
@@ -852,6 +853,15 @@ config NET_NS
852 853
853endif # NAMESPACES 854endif # NAMESPACES
854 855
856config UIDGID_STRICT_TYPE_CHECKS
857 bool "Require conversions between uid/gids and their internal representation"
858 default n
859 help
860 While the nececessary conversions are being added to all subsystems this option allows
861 the code to continue to build for unconverted subsystems.
862
863 Say Y here if you want the strict type checking enabled
864
855config SCHED_AUTOGROUP 865config SCHED_AUTOGROUP
856 bool "Automatic process group scheduling" 866 bool "Automatic process group scheduling"
857 select EVENTFD 867 select EVENTFD