aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2015-11-19 21:19:29 -0500
committerDan Williams <dan.j.williams@intel.com>2016-01-09 09:30:49 -0500
commit21266be9ed542f13436bd9c75316d43e1e84f6ae (patch)
treecc956d5321e1a9fde60b0e596b5e1d981cbe2409
parent9f9499ae8e6415cefc4fe0a96ad0e27864353c89 (diff)
arch: consolidate CONFIG_STRICT_DEVM in lib/Kconfig.debug
Let all the archs that implement devmem_is_allowed() opt-in to a common definition of CONFIG_STRICT_DEVM in lib/Kconfig.debug. Cc: Kees Cook <keescook@chromium.org> Cc: Russell King <linux@arm.linux.org.uk> Cc: Will Deacon <will.deacon@arm.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: "David S. Miller" <davem@davemloft.net> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com> [heiko: drop 'default y' for s390] Acked-by: Ingo Molnar <mingo@redhat.com> Suggested-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
-rw-r--r--arch/arm/Kconfig1
-rw-r--r--arch/arm/Kconfig.debug14
-rw-r--r--arch/arm64/Kconfig1
-rw-r--r--arch/arm64/Kconfig.debug14
-rw-r--r--arch/frv/Kconfig1
-rw-r--r--arch/m32r/Kconfig1
-rw-r--r--arch/powerpc/Kconfig1
-rw-r--r--arch/powerpc/Kconfig.debug12
-rw-r--r--arch/s390/Kconfig1
-rw-r--r--arch/s390/Kconfig.debug12
-rw-r--r--arch/tile/Kconfig4
-rw-r--r--arch/unicore32/Kconfig1
-rw-r--r--arch/unicore32/Kconfig.debug14
-rw-r--r--arch/x86/Kconfig1
-rw-r--r--arch/x86/Kconfig.debug17
-rw-r--r--lib/Kconfig.debug22
16 files changed, 31 insertions, 86 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 34e1569a11ee..b8a47974c2d7 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -2,6 +2,7 @@ config ARM
2 bool 2 bool
3 default y 3 default y
4 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE 4 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
5 select ARCH_HAS_DEVMEM_IS_ALLOWED
5 select ARCH_HAS_ELF_RANDOMIZE 6 select ARCH_HAS_ELF_RANDOMIZE
6 select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST 7 select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
7 select ARCH_HAVE_CUSTOM_GPIO_H 8 select ARCH_HAVE_CUSTOM_GPIO_H
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 259c0ca9c99a..e356357d86bb 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -15,20 +15,6 @@ config ARM_PTDUMP
15 kernel. 15 kernel.
16 If in doubt, say "N" 16 If in doubt, say "N"
17 17
18config STRICT_DEVMEM
19 bool "Filter access to /dev/mem"
20 depends on MMU
21 ---help---
22 If this option is disabled, you allow userspace (root) access to all
23 of memory, including kernel and userspace memory. Accidental
24 access to this is obviously disastrous, but specific access can
25 be used by people debugging the kernel.
26
27 If this option is switched on, the /dev/mem file only allows
28 userspace access to memory mapped peripherals.
29
30 If in doubt, say Y.
31
32# RMK wants arm kernels compiled with frame pointers or stack unwinding. 18# RMK wants arm kernels compiled with frame pointers or stack unwinding.
33# If you know what you are doing and are willing to live without stack 19# If you know what you are doing and are willing to live without stack
34# traces, you can get a slightly smaller kernel by setting this option to 20# traces, you can get a slightly smaller kernel by setting this option to
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 871f21783866..08f64b455aa8 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -3,6 +3,7 @@ config ARM64
3 select ACPI_CCA_REQUIRED if ACPI 3 select ACPI_CCA_REQUIRED if ACPI
4 select ACPI_GENERIC_GSI if ACPI 4 select ACPI_GENERIC_GSI if ACPI
5 select ACPI_REDUCED_HARDWARE_ONLY if ACPI 5 select ACPI_REDUCED_HARDWARE_ONLY if ACPI
6 select ARCH_HAS_DEVMEM_IS_ALLOWED
6 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE 7 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
7 select ARCH_HAS_ELF_RANDOMIZE 8 select ARCH_HAS_ELF_RANDOMIZE
8 select ARCH_HAS_GCOV_PROFILE_ALL 9 select ARCH_HAS_GCOV_PROFILE_ALL
diff --git a/arch/arm64/Kconfig.debug b/arch/arm64/Kconfig.debug
index 04fb73b973f1..e13c4bf84d9e 100644
--- a/arch/arm64/Kconfig.debug
+++ b/arch/arm64/Kconfig.debug
@@ -14,20 +14,6 @@ config ARM64_PTDUMP
14 kernel. 14 kernel.
15 If in doubt, say "N" 15 If in doubt, say "N"
16 16
17config STRICT_DEVMEM
18 bool "Filter access to /dev/mem"
19 depends on MMU
20 help
21 If this option is disabled, you allow userspace (root) access to all
22 of memory, including kernel and userspace memory. Accidental
23 access to this is obviously disastrous, but specific access can
24 be used by people debugging the kernel.
25
26 If this option is switched on, the /dev/mem file only allows
27 userspace access to memory mapped peripherals.
28
29 If in doubt, say Y.
30
31config PID_IN_CONTEXTIDR 17config PID_IN_CONTEXTIDR
32 bool "Write the current PID to the CONTEXTIDR register" 18 bool "Write the current PID to the CONTEXTIDR register"
33 help 19 help
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig
index 34aa19352dc1..03bfd6bf03e7 100644
--- a/arch/frv/Kconfig
+++ b/arch/frv/Kconfig
@@ -10,6 +10,7 @@ config FRV
10 select HAVE_DEBUG_BUGVERBOSE 10 select HAVE_DEBUG_BUGVERBOSE
11 select ARCH_HAVE_NMI_SAFE_CMPXCHG 11 select ARCH_HAVE_NMI_SAFE_CMPXCHG
12 select GENERIC_CPU_DEVICES 12 select GENERIC_CPU_DEVICES
13 select ARCH_HAS_DEVMEM_IS_ALLOWED
13 select ARCH_WANT_IPC_PARSE_VERSION 14 select ARCH_WANT_IPC_PARSE_VERSION
14 select OLD_SIGSUSPEND3 15 select OLD_SIGSUSPEND3
15 select OLD_SIGACTION 16 select OLD_SIGACTION
diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig
index 9e44bbd8051e..836ac5a963c8 100644
--- a/arch/m32r/Kconfig
+++ b/arch/m32r/Kconfig
@@ -13,6 +13,7 @@ config M32R
13 select GENERIC_IRQ_PROBE 13 select GENERIC_IRQ_PROBE
14 select GENERIC_IRQ_SHOW 14 select GENERIC_IRQ_SHOW
15 select GENERIC_ATOMIC64 15 select GENERIC_ATOMIC64
16 select ARCH_HAS_DEVMEM_IS_ALLOWED
16 select ARCH_USES_GETTIMEOFFSET 17 select ARCH_USES_GETTIMEOFFSET
17 select MODULES_USE_ELF_RELA 18 select MODULES_USE_ELF_RELA
18 select HAVE_DEBUG_STACKOVERFLOW 19 select HAVE_DEBUG_STACKOVERFLOW
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index db49e0d796b1..85eabc49de61 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -159,6 +159,7 @@ config PPC
159 select EDAC_SUPPORT 159 select EDAC_SUPPORT
160 select EDAC_ATOMIC_SCRUB 160 select EDAC_ATOMIC_SCRUB
161 select ARCH_HAS_DMA_SET_COHERENT_MASK 161 select ARCH_HAS_DMA_SET_COHERENT_MASK
162 select ARCH_HAS_DEVMEM_IS_ALLOWED
162 select HAVE_ARCH_SECCOMP_FILTER 163 select HAVE_ARCH_SECCOMP_FILTER
163 164
164config GENERIC_CSUM 165config GENERIC_CSUM
diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
index 3a510f4a6b68..a0e44a9c456f 100644
--- a/arch/powerpc/Kconfig.debug
+++ b/arch/powerpc/Kconfig.debug
@@ -335,18 +335,6 @@ config PPC_EARLY_DEBUG_CPM_ADDR
335 platform probing is done, all platforms selected must 335 platform probing is done, all platforms selected must
336 share the same address. 336 share the same address.
337 337
338config STRICT_DEVMEM
339 def_bool y
340 prompt "Filter access to /dev/mem"
341 help
342 This option restricts access to /dev/mem. If this option is
343 disabled, you allow userspace access to all memory, including
344 kernel and userspace memory. Accidental memory access is likely
345 to be disastrous.
346 Memory access is required for experts who want to debug the kernel.
347
348 If you are unsure, say Y.
349
350config FAIL_IOMMU 338config FAIL_IOMMU
351 bool "Fault-injection capability for IOMMU" 339 bool "Fault-injection capability for IOMMU"
352 depends on FAULT_INJECTION 340 depends on FAULT_INJECTION
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 3a55f493c7da..779becb895be 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -66,6 +66,7 @@ config S390
66 def_bool y 66 def_bool y
67 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE 67 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
68 select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS 68 select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS
69 select ARCH_HAS_DEVMEM_IS_ALLOWED
69 select ARCH_HAS_ELF_RANDOMIZE 70 select ARCH_HAS_ELF_RANDOMIZE
70 select ARCH_HAS_GCOV_PROFILE_ALL 71 select ARCH_HAS_GCOV_PROFILE_ALL
71 select ARCH_HAS_SG_CHAIN 72 select ARCH_HAS_SG_CHAIN
diff --git a/arch/s390/Kconfig.debug b/arch/s390/Kconfig.debug
index c56878e1245f..26c5d5beb4be 100644
--- a/arch/s390/Kconfig.debug
+++ b/arch/s390/Kconfig.debug
@@ -5,18 +5,6 @@ config TRACE_IRQFLAGS_SUPPORT
5 5
6source "lib/Kconfig.debug" 6source "lib/Kconfig.debug"
7 7
8config STRICT_DEVMEM
9 def_bool y
10 prompt "Filter access to /dev/mem"
11 ---help---
12 This option restricts access to /dev/mem. If this option is
13 disabled, you allow userspace access to all memory, including
14 kernel and userspace memory. Accidental memory access is likely
15 to be disastrous.
16 Memory access is required for experts who want to debug the kernel.
17
18 If you are unsure, say Y.
19
20config S390_PTDUMP 8config S390_PTDUMP
21 bool "Export kernel pagetable layout to userspace via debugfs" 9 bool "Export kernel pagetable layout to userspace via debugfs"
22 depends on DEBUG_KERNEL 10 depends on DEBUG_KERNEL
diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig
index 106c21bd7f44..cf3116887509 100644
--- a/arch/tile/Kconfig
+++ b/arch/tile/Kconfig
@@ -19,6 +19,7 @@ config TILE
19 select VIRT_TO_BUS 19 select VIRT_TO_BUS
20 select SYS_HYPERVISOR 20 select SYS_HYPERVISOR
21 select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS 21 select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS
22 select ARCH_HAS_DEVMEM_IS_ALLOWED
22 select ARCH_HAVE_NMI_SAFE_CMPXCHG 23 select ARCH_HAVE_NMI_SAFE_CMPXCHG
23 select GENERIC_CLOCKEVENTS 24 select GENERIC_CLOCKEVENTS
24 select MODULES_USE_ELF_RELA 25 select MODULES_USE_ELF_RELA
@@ -116,9 +117,6 @@ config ARCH_DISCONTIGMEM_DEFAULT
116config TRACE_IRQFLAGS_SUPPORT 117config TRACE_IRQFLAGS_SUPPORT
117 def_bool y 118 def_bool y
118 119
119config STRICT_DEVMEM
120 def_bool y
121
122# SMP is required for Tilera Linux. 120# SMP is required for Tilera Linux.
123config SMP 121config SMP
124 def_bool y 122 def_bool y
diff --git a/arch/unicore32/Kconfig b/arch/unicore32/Kconfig
index c9faddc61100..5dc4c0a43ccd 100644
--- a/arch/unicore32/Kconfig
+++ b/arch/unicore32/Kconfig
@@ -1,5 +1,6 @@
1config UNICORE32 1config UNICORE32
2 def_bool y 2 def_bool y
3 select ARCH_HAS_DEVMEM_IS_ALLOWED
3 select ARCH_MIGHT_HAVE_PC_PARPORT 4 select ARCH_MIGHT_HAVE_PC_PARPORT
4 select ARCH_MIGHT_HAVE_PC_SERIO 5 select ARCH_MIGHT_HAVE_PC_SERIO
5 select HAVE_MEMBLOCK 6 select HAVE_MEMBLOCK
diff --git a/arch/unicore32/Kconfig.debug b/arch/unicore32/Kconfig.debug
index 1a3626239843..f075bbe1d46f 100644
--- a/arch/unicore32/Kconfig.debug
+++ b/arch/unicore32/Kconfig.debug
@@ -2,20 +2,6 @@ menu "Kernel hacking"
2 2
3source "lib/Kconfig.debug" 3source "lib/Kconfig.debug"
4 4
5config STRICT_DEVMEM
6 bool "Filter access to /dev/mem"
7 depends on MMU
8 ---help---
9 If this option is disabled, you allow userspace (root) access to all
10 of memory, including kernel and userspace memory. Accidental
11 access to this is obviously disastrous, but specific access can
12 be used by people debugging the kernel.
13
14 If this option is switched on, the /dev/mem file only allows
15 userspace access to memory mapped peripherals.
16
17 If in doubt, say Y.
18
19config EARLY_PRINTK 5config EARLY_PRINTK
20 def_bool DEBUG_OCD 6 def_bool DEBUG_OCD
21 help 7 help
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index db3622f22b61..75fba1fc205d 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -24,6 +24,7 @@ config X86
24 select ARCH_DISCARD_MEMBLOCK 24 select ARCH_DISCARD_MEMBLOCK
25 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE 25 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
26 select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS 26 select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS
27 select ARCH_HAS_DEVMEM_IS_ALLOWED
27 select ARCH_HAS_ELF_RANDOMIZE 28 select ARCH_HAS_ELF_RANDOMIZE
28 select ARCH_HAS_FAST_MULTIPLIER 29 select ARCH_HAS_FAST_MULTIPLIER
29 select ARCH_HAS_GCOV_PROFILE_ALL 30 select ARCH_HAS_GCOV_PROFILE_ALL
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index 137dfa96aa14..1116452fcfc2 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -5,23 +5,6 @@ config TRACE_IRQFLAGS_SUPPORT
5 5
6source "lib/Kconfig.debug" 6source "lib/Kconfig.debug"
7 7
8config STRICT_DEVMEM
9 bool "Filter access to /dev/mem"
10 ---help---
11 If this option is disabled, you allow userspace (root) access to all
12 of memory, including kernel and userspace memory. Accidental
13 access to this is obviously disastrous, but specific access can
14 be used by people debugging the kernel. Note that with PAT support
15 enabled, even in this case there are restrictions on /dev/mem
16 use due to the cache aliasing requirements.
17
18 If this option is switched on, the /dev/mem file only allows
19 userspace access to PCI space and the BIOS code and data regions.
20 This is sufficient for dosemu and X and all common users of
21 /dev/mem.
22
23 If in doubt, say Y.
24
25config X86_VERBOSE_BOOTUP 8config X86_VERBOSE_BOOTUP
26 bool "Enable verbose x86 bootup info messages" 9 bool "Enable verbose x86 bootup info messages"
27 default y 10 default y
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 8c15b29d5adc..289dfcbc14eb 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -1853,3 +1853,25 @@ source "samples/Kconfig"
1853 1853
1854source "lib/Kconfig.kgdb" 1854source "lib/Kconfig.kgdb"
1855 1855
1856config ARCH_HAS_DEVMEM_IS_ALLOWED
1857 bool
1858
1859config STRICT_DEVMEM
1860 bool "Filter access to /dev/mem"
1861 depends on MMU
1862 depends on ARCH_HAS_DEVMEM_IS_ALLOWED
1863 default y if TILE || PPC
1864 ---help---
1865 If this option is disabled, you allow userspace (root) access to all
1866 of memory, including kernel and userspace memory. Accidental
1867 access to this is obviously disastrous, but specific access can
1868 be used by people debugging the kernel. Note that with PAT support
1869 enabled, even in this case there are restrictions on /dev/mem
1870 use due to the cache aliasing requirements.
1871
1872 If this option is switched on, the /dev/mem file only allows
1873 userspace access to PCI space and the BIOS code and data regions.
1874 This is sufficient for dosemu and X and all common users of
1875 /dev/mem.
1876
1877 If in doubt, say Y.