提交 4046d6e8 编写于 作者: L Linus Torvalds

Revert "x86: remove the kernel code/data/bss resources from /proc/iomem"

This reverts commit c4004b02.

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: NZhengyu Zhang <zhezhang@redhat.com>
Reported-by: NDave Young <dyoung@redhat.com>
Reported-by: NFreeman Zhang <freeman.zhang1992@gmail.com>
Reported-by: NEmrah Demir <ed@abdsec.com>
Reported-by: NBaoquan He <bhe@redhat.com>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 90de6800
...@@ -146,6 +146,31 @@ int default_check_phys_apicid_present(int phys_apicid) ...@@ -146,6 +146,31 @@ int default_check_phys_apicid_present(int phys_apicid)
struct boot_params boot_params; struct boot_params boot_params;
/*
* Machine setup..
*/
static struct resource data_resource = {
.name = "Kernel data",
.start = 0,
.end = 0,
.flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM
};
static struct resource code_resource = {
.name = "Kernel code",
.start = 0,
.end = 0,
.flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM
};
static struct resource bss_resource = {
.name = "Kernel bss",
.start = 0,
.end = 0,
.flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM
};
#ifdef CONFIG_X86_32 #ifdef CONFIG_X86_32
/* cpu data as detected by the assembly code in head.S */ /* cpu data as detected by the assembly code in head.S */
struct cpuinfo_x86 new_cpu_data = { struct cpuinfo_x86 new_cpu_data = {
...@@ -924,6 +949,13 @@ void __init setup_arch(char **cmdline_p) ...@@ -924,6 +949,13 @@ void __init setup_arch(char **cmdline_p)
mpx_mm_init(&init_mm); mpx_mm_init(&init_mm);
code_resource.start = __pa_symbol(_text);
code_resource.end = __pa_symbol(_etext)-1;
data_resource.start = __pa_symbol(_etext);
data_resource.end = __pa_symbol(_edata)-1;
bss_resource.start = __pa_symbol(__bss_start);
bss_resource.end = __pa_symbol(__bss_stop)-1;
#ifdef CONFIG_CMDLINE_BOOL #ifdef CONFIG_CMDLINE_BOOL
#ifdef CONFIG_CMDLINE_OVERRIDE #ifdef CONFIG_CMDLINE_OVERRIDE
strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
...@@ -987,6 +1019,11 @@ void __init setup_arch(char **cmdline_p) ...@@ -987,6 +1019,11 @@ void __init setup_arch(char **cmdline_p)
x86_init.resources.probe_roms(); x86_init.resources.probe_roms();
/* after parse_early_param, so could debug it */
insert_resource(&iomem_resource, &code_resource);
insert_resource(&iomem_resource, &data_resource);
insert_resource(&iomem_resource, &bss_resource);
e820_add_kernel_range(); e820_add_kernel_range();
trim_bios_range(); trim_bios_range();
#ifdef CONFIG_X86_32 #ifdef CONFIG_X86_32
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册