]> Pileus Git - ~andy/linux/commitdiff
userns: Add a Kconfig option to enforce strict kuid and kgid type checks
authorEric W. Biederman <ebiederm@xmission.com>
Thu, 17 Nov 2011 18:23:55 +0000 (10:23 -0800)
committerEric W. Biederman <ebiederm@xmission.com>
Sun, 8 Apr 2012 00:11:01 +0000 (17:11 -0700)
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>
include/linux/uidgid.h
init/Kconfig

index a0addb8e5889c54dbbab4e14146c35f7defe587a..539856829caf04d2260ca9262b6d6b78a1c14a19 100644 (file)
@@ -17,7 +17,7 @@
 struct user_namespace;
 extern struct user_namespace init_user_ns;
 
-#if defined(NOTYET)
+#ifdef CONFIG_UIDGID_STRICT_TYPE_CHECKS
 
 typedef struct {
        uid_t val;
index 72f33faca44fbef6734cdce724090c917ccf52b9..86cf760893b3b57c507736c00665eb337b378a82 100644 (file)
@@ -828,7 +828,8 @@ config IPC_NS
 config USER_NS
        bool "User namespace (EXPERIMENTAL)"
        depends on EXPERIMENTAL
-       default y
+       select UIDGID_STRICT_TYPE_CHECKS
+       default n
        help
          This allows containers, i.e. vservers, to use user namespaces
          to provide different user info for different servers.
@@ -852,6 +853,15 @@ config NET_NS
 
 endif # NAMESPACES
 
+config UIDGID_STRICT_TYPE_CHECKS
+       bool "Require conversions between uid/gids and their internal representation"
+       default n
+       help
+        While the nececessary conversions are being added to all subsystems this option allows
+        the code to continue to build for unconverted subsystems.
+
+        Say Y here if you want the strict type checking enabled
+
 config SCHED_AUTOGROUP
        bool "Automatic process group scheduling"
        select EVENTFD