diff options
author | Arjan van de Ven <arjan@linux.intel.com> | 2008-04-24 17:40:47 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-04-24 17:40:47 -0400 |
commit | ae531c26c5c2a28ca1b35a75b39b3b256850f2c8 (patch) | |
tree | e4c2f3ec25bdb0e2e5f7f15f79a60c3175f03718 /arch/x86/Kconfig.debug | |
parent | 94bc891b00e40cbec375feb4568780af183fd7f4 (diff) |
x86: introduce /dev/mem restrictions with a config option
This patch introduces a restriction on /dev/mem: Only non-memory can be
read or written unless the newly introduced config option is set.
The X server needs access to /dev/mem for the PCI space, but it doesn't need
access to memory; both the file permissions and SELinux permissions of /dev/mem
just make X effectively super-super powerful. With the exception of the
BIOS area, there's just no valid app that uses /dev/mem on actual memory.
Other popular users of /dev/mem are rootkits and the like.
(note: mmap access of memory via /dev/mem was already not allowed since
a really long time)
People who want to use /dev/mem for kernel debugging can enable the config
option.
The restrictions of this patch have been in the Fedora and RHEL kernels for
at least 4 years without any problems.
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/Kconfig.debug')
-rw-r--r-- | arch/x86/Kconfig.debug | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug index 610aaecc19f8..0c1890c41279 100644 --- a/arch/x86/Kconfig.debug +++ b/arch/x86/Kconfig.debug | |||
@@ -5,6 +5,18 @@ config TRACE_IRQFLAGS_SUPPORT | |||
5 | 5 | ||
6 | source "lib/Kconfig.debug" | 6 | source "lib/Kconfig.debug" |
7 | 7 | ||
8 | config NONPROMISC_DEVMEM | ||
9 | bool "Disable promiscuous /dev/mem" | ||
10 | default y | ||
11 | help | ||
12 | The /dev/mem file by default only allows userspace access to PCI | ||
13 | space and the BIOS code and data regions. This is sufficient for | ||
14 | dosemu and X and all common users of /dev/mem. With this config | ||
15 | option, you allow userspace access to all of memory, including | ||
16 | kernel and userspace memory. Accidental access to this is | ||
17 | obviously disasterous, but specific access can be used by people | ||
18 | debugging the kernel. | ||
19 | |||
8 | config EARLY_PRINTK | 20 | config EARLY_PRINTK |
9 | bool "Early printk" if EMBEDDED | 21 | bool "Early printk" if EMBEDDED |
10 | default y | 22 | default y |