Skip to content

Commit 045f6d7

Browse files
changbindutorvalds
authored andcommitted
lib/Kconfig.debug: fix some messed up configurations
Some configuration items are messed up during conflict resolving. For example, STRICT_DEVMEM should not in testing menu, but kunit should. This patch fixes all of them. [[email protected]: coding style fixes] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Changbin Du <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 42a9a53 commit 045f6d7

File tree

1 file changed

+51
-49
lines changed

1 file changed

+51
-49
lines changed

lib/Kconfig.debug

Lines changed: 51 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,6 +1483,55 @@ config PROVIDE_OHCI1394_DMA_INIT
14831483

14841484
See Documentation/debugging-via-ohci1394.txt for more information.
14851485

1486+
source "samples/Kconfig"
1487+
1488+
config ARCH_HAS_DEVMEM_IS_ALLOWED
1489+
bool
1490+
1491+
config STRICT_DEVMEM
1492+
bool "Filter access to /dev/mem"
1493+
depends on MMU && DEVMEM
1494+
depends on ARCH_HAS_DEVMEM_IS_ALLOWED
1495+
default y if PPC || X86 || ARM64
1496+
help
1497+
If this option is disabled, you allow userspace (root) access to all
1498+
of memory, including kernel and userspace memory. Accidental
1499+
access to this is obviously disastrous, but specific access can
1500+
be used by people debugging the kernel. Note that with PAT support
1501+
enabled, even in this case there are restrictions on /dev/mem
1502+
use due to the cache aliasing requirements.
1503+
1504+
If this option is switched on, and IO_STRICT_DEVMEM=n, the /dev/mem
1505+
file only allows userspace access to PCI space and the BIOS code and
1506+
data regions. This is sufficient for dosemu and X and all common
1507+
users of /dev/mem.
1508+
1509+
If in doubt, say Y.
1510+
1511+
config IO_STRICT_DEVMEM
1512+
bool "Filter I/O access to /dev/mem"
1513+
depends on STRICT_DEVMEM
1514+
help
1515+
If this option is disabled, you allow userspace (root) access to all
1516+
io-memory regardless of whether a driver is actively using that
1517+
range. Accidental access to this is obviously disastrous, but
1518+
specific access can be used by people debugging kernel drivers.
1519+
1520+
If this option is switched on, the /dev/mem file only allows
1521+
userspace access to *idle* io-memory ranges (see /proc/iomem) This
1522+
may break traditional users of /dev/mem (dosemu, legacy X, etc...)
1523+
if the driver using a given range cannot be disabled.
1524+
1525+
If in doubt, say Y.
1526+
1527+
menu "$(SRCARCH) Debugging"
1528+
1529+
source "arch/$(SRCARCH)/Kconfig.debug"
1530+
1531+
endmenu
1532+
1533+
menu "Kernel Testing and Coverage"
1534+
14861535
source "lib/kunit/Kconfig"
14871536

14881537
config NOTIFIER_ERROR_INJECTION
@@ -1643,10 +1692,6 @@ config FAULT_INJECTION_STACKTRACE_FILTER
16431692
help
16441693
Provide stacktrace filter for fault-injection capabilities
16451694

1646-
endmenu # "Kernel Testing and Coverage"
1647-
1648-
menu "Kernel Testing and Coverage"
1649-
16501695
config ARCH_HAS_KCOV
16511696
bool
16521697
help
@@ -2130,52 +2175,7 @@ config MEMTEST
21302175
memtest=17, mean do 17 test patterns.
21312176
If you are unsure how to answer this question, answer N.
21322177

2133-
source "samples/Kconfig"
2134-
2135-
config ARCH_HAS_DEVMEM_IS_ALLOWED
2136-
bool
2137-
2138-
config STRICT_DEVMEM
2139-
bool "Filter access to /dev/mem"
2140-
depends on MMU && DEVMEM
2141-
depends on ARCH_HAS_DEVMEM_IS_ALLOWED
2142-
default y if PPC || X86 || ARM64
2143-
---help---
2144-
If this option is disabled, you allow userspace (root) access to all
2145-
of memory, including kernel and userspace memory. Accidental
2146-
access to this is obviously disastrous, but specific access can
2147-
be used by people debugging the kernel. Note that with PAT support
2148-
enabled, even in this case there are restrictions on /dev/mem
2149-
use due to the cache aliasing requirements.
2150-
2151-
If this option is switched on, and IO_STRICT_DEVMEM=n, the /dev/mem
2152-
file only allows userspace access to PCI space and the BIOS code and
2153-
data regions. This is sufficient for dosemu and X and all common
2154-
users of /dev/mem.
2155-
2156-
If in doubt, say Y.
21572178

2158-
config IO_STRICT_DEVMEM
2159-
bool "Filter I/O access to /dev/mem"
2160-
depends on STRICT_DEVMEM
2161-
---help---
2162-
If this option is disabled, you allow userspace (root) access to all
2163-
io-memory regardless of whether a driver is actively using that
2164-
range. Accidental access to this is obviously disastrous, but
2165-
specific access can be used by people debugging kernel drivers.
2166-
2167-
If this option is switched on, the /dev/mem file only allows
2168-
userspace access to *idle* io-memory ranges (see /proc/iomem) This
2169-
may break traditional users of /dev/mem (dosemu, legacy X, etc...)
2170-
if the driver using a given range cannot be disabled.
2171-
2172-
If in doubt, say Y.
2173-
2174-
menu "$(SRCARCH) Debugging"
2175-
2176-
source "arch/$(SRCARCH)/Kconfig.debug"
2177-
2178-
endmenu
21792179

21802180
config HYPERV_TESTING
21812181
bool "Microsoft Hyper-V driver testing"
@@ -2184,4 +2184,6 @@ config HYPERV_TESTING
21842184
help
21852185
Select this option to enable Hyper-V vmbus testing.
21862186

2187+
endmenu # "Kernel Testing and Coverage"
2188+
21872189
endmenu # Kernel hacking

0 commit comments

Comments
 (0)