Skip to content

Commit

Permalink
x86: remove the kernel code/data/bss resources from /proc/iomem
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
torvalds committed Apr 6, 2016
1 parent 9cb5b78 commit c4004b0
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions arch/x86/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,31 +146,6 @@ int default_check_phys_apicid_present(int phys_apicid)

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
/* cpu data as detected by the assembly code in head.S */
struct cpuinfo_x86 new_cpu_data = {
Expand Down Expand Up @@ -949,13 +924,6 @@ void __init setup_arch(char **cmdline_p)

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_OVERRIDE
strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
Expand Down Expand Up @@ -1019,11 +987,6 @@ void __init setup_arch(char **cmdline_p)

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();
trim_bios_range();
#ifdef CONFIG_X86_32
Expand Down

0 comments on commit c4004b0

Please sign in to comment.