aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-04-14 14:18:57 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-04-14 15:55:32 -0400
commit4046d6e81f33b7ef50d6668b78076d54c5e066b6 (patch)
tree82e71d01a1deffd840e034c19f9c5bc4d8495c63
parent90de6800c240dfe089e254116a7c055e70b709fd (diff)
Revert "x86: remove the kernel code/data/bss resources from /proc/iomem"
This reverts commit c4004b02f8e5b9ce357a0bb1641756cc86962664. Sadly, my hope that nobody would actually use the special kernel entries in /proc/iomem were dashed by kexec. Which reads /proc/iomem explicitly to find the kernel base address. Nasty. Anyway, that means we can't do the sane and simple thing and just remove the entries, and we'll instead have to mask them out based on permissions. Reported-by: Zhengyu Zhang <zhezhang@redhat.com> Reported-by: Dave Young <dyoung@redhat.com> Reported-by: Freeman Zhang <freeman.zhang1992@gmail.com> Reported-by: Emrah Demir <ed@abdsec.com> Reported-by: Baoquan He <bhe@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--arch/x86/kernel/setup.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 319b08a5b6ed..2367ae07eb76 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -146,6 +146,31 @@ int default_check_phys_apicid_present(int phys_apicid)
146 146
147struct boot_params boot_params; 147struct boot_params boot_params;
148 148
149/*
150 * Machine setup..
151 */
152static struct resource data_resource = {
153 .name = "Kernel data",
154 .start = 0,
155 .end = 0,
156 .flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM
157};
158
159static struct resource code_resource = {
160 .name = "Kernel code",
161 .start = 0,
162 .end = 0,
163 .flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM
164};
165
166static struct resource bss_resource = {
167 .name = "Kernel bss",
168 .start = 0,
169 .end = 0,
170 .flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM
171};
172
173
149#ifdef CONFIG_X86_32 174#ifdef CONFIG_X86_32
150/* cpu data as detected by the assembly code in head.S */ 175/* cpu data as detected by the assembly code in head.S */
151struct cpuinfo_x86 new_cpu_data = { 176struct cpuinfo_x86 new_cpu_data = {
@@ -924,6 +949,13 @@ void __init setup_arch(char **cmdline_p)
924 949
925 mpx_mm_init(&init_mm); 950 mpx_mm_init(&init_mm);
926 951
952 code_resource.start = __pa_symbol(_text);
953 code_resource.end = __pa_symbol(_etext)-1;
954 data_resource.start = __pa_symbol(_etext);
955 data_resource.end = __pa_symbol(_edata)-1;
956 bss_resource.start = __pa_symbol(__bss_start);
957 bss_resource.end = __pa_symbol(__bss_stop)-1;
958
927#ifdef CONFIG_CMDLINE_BOOL 959#ifdef CONFIG_CMDLINE_BOOL
928#ifdef CONFIG_CMDLINE_OVERRIDE 960#ifdef CONFIG_CMDLINE_OVERRIDE
929 strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); 961 strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
@@ -987,6 +1019,11 @@ void __init setup_arch(char **cmdline_p)
987 1019
988 x86_init.resources.probe_roms(); 1020 x86_init.resources.probe_roms();
989 1021
1022 /* after parse_early_param, so could debug it */
1023 insert_resource(&iomem_resource, &code_resource);
1024 insert_resource(&iomem_resource, &data_resource);
1025 insert_resource(&iomem_resource, &bss_resource);
1026
990 e820_add_kernel_range(); 1027 e820_add_kernel_range();
991 trim_bios_range(); 1028 trim_bios_range();
992#ifdef CONFIG_X86_32 1029#ifdef CONFIG_X86_32