Skip to content

Commit c4004b0

Browse files
committed
x86: remove the kernel code/data/bss resources from /proc/iomem
Let's see if anybody even notices. I doubt anybody uses this, and it does expose addresses that should be randomized, so let's just remove the code. It's old and traditional, and it used to be cute, but we should have removed this long ago. If it turns out anybody notices and this breaks something, we'll have to revert this, and maybe we'll end up using other approaches instead (using %pK or similar). But removing unnecessary code is always the preferred option. Noted-by: Emrah Demir <ed@abdsec.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 9cb5b78 commit c4004b0

File tree

1 file changed

+0
-37
lines changed

1 file changed

+0
-37
lines changed

arch/x86/kernel/setup.c

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -146,31 +146,6 @@ int default_check_phys_apicid_present(int phys_apicid)
146146

147147
struct boot_params boot_params;
148148

149-
/*
150-
* Machine setup..
151-
*/
152-
static struct resource data_resource = {
153-
.name = "Kernel data",
154-
.start = 0,
155-
.end = 0,
156-
.flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM
157-
};
158-
159-
static struct resource code_resource = {
160-
.name = "Kernel code",
161-
.start = 0,
162-
.end = 0,
163-
.flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM
164-
};
165-
166-
static struct resource bss_resource = {
167-
.name = "Kernel bss",
168-
.start = 0,
169-
.end = 0,
170-
.flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM
171-
};
172-
173-
174149
#ifdef CONFIG_X86_32
175150
/* cpu data as detected by the assembly code in head.S */
176151
struct cpuinfo_x86 new_cpu_data = {
@@ -949,13 +924,6 @@ void __init setup_arch(char **cmdline_p)
949924

950925
mpx_mm_init(&init_mm);
951926

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-
959927
#ifdef CONFIG_CMDLINE_BOOL
960928
#ifdef CONFIG_CMDLINE_OVERRIDE
961929
strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
@@ -1019,11 +987,6 @@ void __init setup_arch(char **cmdline_p)
1019987

1020988
x86_init.resources.probe_roms();
1021989

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-
1027990
e820_add_kernel_range();
1028991
trim_bios_range();
1029992
#ifdef CONFIG_X86_32

0 commit comments

Comments
 (0)