]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
The help text for this config is duplicated across the x86, parisc, and
authorStephen Boyd <sboyd@codeaurora.org>
Wed, 24 Aug 2011 23:47:27 +0000 (09:47 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 5 Sep 2011 07:02:26 +0000 (17:02 +1000)
s390 Kconfig.debug files.  Arnd Bergman noted that the help text was
slightly misleading and should be fixed to state that enabling this option
isn't a problem when using pre 4.4 gcc.

To simplify the rewording, consolidate the text into lib/Kconfig.debug and
modify it there to be more explicit about when you should say N to this
config.

Also, make the text a bit more generic by stating that this option enables
compile time checks so we can cover architectures which emit warnings vs.
ones which emit errors.  The details of how an architecture decided to
implement the checks isn't as important as the concept of compile time
checking of copy_from_user() calls.

While we're doing this, remove all the copy_from_user_overflow() code
that's duplicated many times and place it into lib/ so that any
architecture supporting this option can get the function for free.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Ingo Molnar <mingo@elte.hu>
Acked-by: H. Peter Anvin <hpa@zytor.com>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Helge Deller <deller@gmx.de>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Acked-by: Chris Metcalf <cmetcalf@tilera.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
17 files changed:
arch/parisc/Kconfig
arch/parisc/Kconfig.debug
arch/s390/Kconfig
arch/s390/Kconfig.debug
arch/s390/lib/Makefile
arch/sparc/lib/Makefile
arch/sparc/lib/usercopy.c [deleted file]
arch/tile/Kconfig
arch/tile/include/asm/uaccess.h
arch/tile/lib/uaccess.c
arch/x86/Kconfig
arch/x86/Kconfig.debug
arch/x86/lib/usercopy_32.c
arch/x86/lib/usercopy_64.c
lib/Kconfig.debug
lib/Makefile
lib/usercopy.c [moved from arch/s390/lib/usercopy.c with 100% similarity]

index e077b0bf56ca51910df1775acd66f319afdae13a..5dcb59ff848d0017cfe4f2a01131dd8a18cd5111 100644 (file)
@@ -7,6 +7,7 @@ config PARISC
        select HAVE_FUNCTION_TRACE_MCOUNT_TEST if 64BIT
        select RTC_CLASS
        select RTC_DRV_GENERIC
+       select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS
        select INIT_ALL_POSSIBLE
        select BUG
        select HAVE_IRQ_WORK
index 7305ac8f7f5ba7438ac2207ada7aaeb60b419d36..bc989e522a045c17ca4514478b7cb5ef9d77fc4d 100644 (file)
@@ -12,18 +12,4 @@ config DEBUG_RODATA
          portion of the kernel code won't be covered by a TLB anymore.
          If in doubt, say "N".
 
-config DEBUG_STRICT_USER_COPY_CHECKS
-       bool "Strict copy size checks"
-       depends on DEBUG_KERNEL && !TRACE_BRANCH_PROFILING
-       ---help---
-         Enabling this option turns a certain set of sanity checks for user
-         copy operations into compile time failures.
-
-         The copy_from_user() etc checks are there to help test if there
-         are sufficient security checks on the length argument of
-         the copy operation, by having gcc prove that the argument is
-         within bounds.
-
-         If unsure, or if you run an older (pre 4.4) gcc, say N.
-
 endmenu
index a9fbd43395f71814d85a284a63900dc5a7dcc018..78f13f23736088e5996bf1f23e803f55d595c8f0 100644 (file)
@@ -120,6 +120,7 @@ config S390
        select ARCH_INLINE_WRITE_UNLOCK_BH
        select ARCH_INLINE_WRITE_UNLOCK_IRQ
        select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE
+       select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS
 
 config SCHED_OMIT_FRAME_POINTER
        def_bool y
index d76cef3fef37bac6f3df5ad6d336a30cdfc8233f..aa1796cc237cd72f79c9dad9df95ab80fc8c82cb 100644 (file)
@@ -17,20 +17,6 @@ config STRICT_DEVMEM
 
          If you are unsure, say Y.
 
-config DEBUG_STRICT_USER_COPY_CHECKS
-       def_bool n
-       prompt "Strict user copy size checks"
-       ---help---
-         Enabling this option turns a certain set of sanity checks for user
-         copy operations into compile time warnings.
-
-         The copy_from_user() etc checks are there to help test if there
-         are sufficient security checks on the length argument of
-         the copy operation, by having gcc prove that the argument is
-         within bounds.
-
-         If unsure, or if you run an older (pre 4.4) gcc, say N.
-
 config DEBUG_SET_MODULE_RONX
        def_bool y
        depends on MODULES
index 761ab8b56afc4cb13080cfc59461fd9bf68a26a9..97975ec7a27471253a8da274af72d14a16e9f171 100644 (file)
@@ -3,7 +3,6 @@
 #
 
 lib-y += delay.o string.o uaccess_std.o uaccess_pt.o
-obj-y += usercopy.o
 obj-$(CONFIG_32BIT) += div64.o qrnnd.o ucmpdi2.o
 lib-$(CONFIG_64BIT) += uaccess_mvcos.o
 lib-$(CONFIG_SMP) += spinlock.o
index a3fc4375a150e9cd637202eefc5d80598db17dce..ddc551cb815ae4856c56e581a93b884a47df55e1 100644 (file)
@@ -43,4 +43,3 @@ obj-y                 += iomap.o
 obj-$(CONFIG_SPARC32) += atomic32.o
 obj-y                 += ksyms.o
 obj-$(CONFIG_SPARC64) += PeeCeeI.o
-obj-y                 += usercopy.o
diff --git a/arch/sparc/lib/usercopy.c b/arch/sparc/lib/usercopy.c
deleted file mode 100644 (file)
index 14b363f..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <linux/module.h>
-#include <linux/bug.h>
-
-void copy_from_user_overflow(void)
-{
-       WARN(1, "Buffer overflow detected!\n");
-}
-EXPORT_SYMBOL(copy_from_user_overflow);
index b30f71ac0d0657f24d6a37f13c7ad802d9f36708..99ee890d0aa197bf0956787f381e5ac0354ac7a5 100644 (file)
@@ -7,6 +7,7 @@ config TILE
        select GENERIC_FIND_FIRST_BIT
        select USE_GENERIC_SMP_HELPERS
        select CC_OPTIMIZE_FOR_SIZE
+       select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS
        select HAVE_GENERIC_HARDIRQS
        select GENERIC_IRQ_PROBE
        select GENERIC_PENDING_IRQ if SMP
@@ -97,13 +98,6 @@ config STRICT_DEVMEM
 config SMP
        def_bool y
 
-# Allow checking for compile-time determined overflow errors in
-# copy_from_user().  There are still unprovable places in the
-# generic code as of 2.6.34, so this option is not really compatible
-# with -Werror, which is more useful in general.
-config DEBUG_COPY_FROM_USER
-       def_bool n
-
 config HVC_TILE
        select HVC_DRIVER
        def_bool y
index ef34d2caa5b1b6205775da2dfe352274569a0e73..9a540be3149e47b79317e5941e04b33becfe6f9c 100644 (file)
@@ -353,7 +353,12 @@ _copy_from_user(void *to, const void __user *from, unsigned long n)
        return n;
 }
 
-#ifdef CONFIG_DEBUG_COPY_FROM_USER
+#ifdef CONFIG_DEBUG_STRICT_USER_COPY_CHECKS
+/*
+ * There are still unprovable places in the generic code as of 2.6.34, so this
+ * option is not really compatible with -Werror, which is more useful in
+ * general.
+ */
 extern void copy_from_user_overflow(void)
        __compiletime_warning("copy_from_user() size is not provably correct");
 
index f8d398c9ee7f3e174b70d94648db32d7500b2e80..030abe3ee4f1da38380cd592a7405fdefd346c36 100644 (file)
@@ -22,11 +22,3 @@ int __range_ok(unsigned long addr, unsigned long size)
                 is_arch_mappable_range(addr, size));
 }
 EXPORT_SYMBOL(__range_ok);
-
-#ifdef CONFIG_DEBUG_COPY_FROM_USER
-void copy_from_user_overflow(void)
-{
-       WARN(1, "Buffer overflow detected!\n");
-}
-EXPORT_SYMBOL(copy_from_user_overflow);
-#endif
index d18e7a28852cdb40df713c521580627462d5723a..ff6d4e7d0b3eafd3fdcf84001aaef3a4e1929a52 100644 (file)
@@ -64,6 +64,7 @@ config X86
        select HAVE_TEXT_POKE_SMP
        select HAVE_GENERIC_HARDIRQS
        select HAVE_SPARSE_IRQ
+       select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS
        select GENERIC_FIND_FIRST_BIT
        select GENERIC_IRQ_PROBE
        select GENERIC_PENDING_IRQ if SMP
index c0f8a5c889107bf80ab45eaf33468e5120ee6a56..2b00959c10610c678b0a969af4db3f1acb70420b 100644 (file)
@@ -270,18 +270,4 @@ config OPTIMIZE_INLINING
 
          If unsure, say N.
 
-config DEBUG_STRICT_USER_COPY_CHECKS
-       bool "Strict copy size checks"
-       depends on DEBUG_KERNEL && !TRACE_BRANCH_PROFILING
-       ---help---
-         Enabling this option turns a certain set of sanity checks for user
-         copy operations into compile time failures.
-
-         The copy_from_user() etc checks are there to help test if there
-         are sufficient security checks on the length argument of
-         the copy operation, by having gcc prove that the argument is
-         within bounds.
-
-         If unsure, or if you run an older (pre 4.4) gcc, say N.
-
 endmenu
index e218d5df85ff23445c277c2fe89d611dcab433ae..8498684e45b0d0864b490a2673daffdc0db01241 100644 (file)
@@ -883,9 +883,3 @@ _copy_from_user(void *to, const void __user *from, unsigned long n)
        return n;
 }
 EXPORT_SYMBOL(_copy_from_user);
-
-void copy_from_user_overflow(void)
-{
-       WARN(1, "Buffer overflow detected!\n");
-}
-EXPORT_SYMBOL(copy_from_user_overflow);
index d7a5d9ac5479750131957c7fc83e4d5d26dac6db..b7c2849ffb66015ed114a5ab2015956aecd69d7b 100644 (file)
@@ -181,9 +181,3 @@ copy_user_handle_tail(char *to, char *from, unsigned len, unsigned zerorest)
                        break;
        return len;
 }
-
-void copy_from_user_overflow(void)
-{
-       WARN(1, "Buffer overflow detected!\n");
-}
-EXPORT_SYMBOL(copy_from_user_overflow);
index 639c95aca53cf4b63069fe0689ed212f6bb7744b..4d6100d83e599a0d7dcab4186875a413f977245c 100644 (file)
@@ -1120,6 +1120,24 @@ config SYSCTL_SYSCALL_CHECK
          to properly maintain and use. This enables checks that help
          you to keep things correct.
 
+config ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS
+       bool
+
+config DEBUG_STRICT_USER_COPY_CHECKS
+       bool "Strict user copy size checks"
+       depends on ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS
+       depends on DEBUG_KERNEL && !TRACE_BRANCH_PROFILING
+       help
+         Enabling this option turns a certain set of sanity checks for user
+         copy operations into compile time failures.
+
+         The copy_from_user() etc checks are there to help test if there
+         are sufficient security checks on the length argument of
+         the copy operation, by having gcc prove that the argument is
+         within bounds.
+
+         If unsure, say N.
+
 source mm/Kconfig.debug
 source kernel/trace/Kconfig
 
index 3f5bc6d903e088e3a8d17dcc458aec006e7ada61..16bcb8d1ab58142bfd98f1e3607376c925629a6d 100644 (file)
@@ -14,6 +14,7 @@ lib-y := ctype.o string.o vsprintf.o cmdline.o \
         proportions.o prio_heap.o ratelimit.o show_mem.o \
         is_single_threaded.o plist.o decompress.o
 
+lib-$(CONFIG_ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS) += usercopy.o
 lib-$(CONFIG_MMU) += ioremap.o
 lib-$(CONFIG_SMP) += cpumask.o
 
similarity index 100%
rename from arch/s390/lib/usercopy.c
rename to lib/usercopy.c