]> Git Repo - linux.git/commitdiff
x86/mm: Report actual image regions in /proc/iomem
authorKees Cook <[email protected]>
Tue, 29 Oct 2019 21:13:50 +0000 (14:13 -0700)
committerBorislav Petkov <[email protected]>
Mon, 4 Nov 2019 18:02:25 +0000 (19:02 +0100)
The resource reservations in /proc/iomem made for the kernel image did
not reflect the gaps between text, rodata, and data. Add the "rodata"
resource and update the start/end calculations to match the respective
calls to free_kernel_image_pages().

Before (booted with "nokaslr" for easier comparison):

00100000-bffd9fff : System RAM
  01000000-01e011d0 : Kernel code
  01e011d1-025619bf : Kernel data
  02a95000-035fffff : Kernel bss

After:

00100000-bffd9fff : System RAM
  01000000-01e011d0 : Kernel code
  02000000-023d4fff : Kernel rodata
  02400000-025619ff : Kernel data
  02a95000-035fffff : Kernel bss

Signed-off-by: Kees Cook <[email protected]>
Signed-off-by: Borislav Petkov <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: Dave Young <[email protected]>
Cc: David Howells <[email protected]>
Cc: Heiko Carstens <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Juergen Gross <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: Michael Ellerman <[email protected]>
Cc: Michal Simek <[email protected]>
Cc: Rick Edgecombe <[email protected]>
Cc: Robert Richter <[email protected]>
Cc: Segher Boessenkool <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Thomas Lendacky <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: x86-ml <[email protected]>
Cc: Yoshinori Sato <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
arch/x86/kernel/setup.c

index 77ea96b794bd13ac285977afc3b8e234187ef996..591e885a852e57cb3bcec99553cd5c9d379d97c5 100644 (file)
@@ -143,6 +143,13 @@ struct boot_params boot_params;
 /*
  * Machine setup..
  */
+static struct resource rodata_resource = {
+       .name   = "Kernel rodata",
+       .start  = 0,
+       .end    = 0,
+       .flags  = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM
+};
+
 static struct resource data_resource = {
        .name   = "Kernel data",
        .start  = 0,
@@ -951,7 +958,9 @@ void __init setup_arch(char **cmdline_p)
 
        code_resource.start = __pa_symbol(_text);
        code_resource.end = __pa_symbol(_etext)-1;
-       data_resource.start = __pa_symbol(_etext);
+       rodata_resource.start = __pa_symbol(__start_rodata);
+       rodata_resource.end = __pa_symbol(__end_rodata)-1;
+       data_resource.start = __pa_symbol(_sdata);
        data_resource.end = __pa_symbol(_edata)-1;
        bss_resource.start = __pa_symbol(__bss_start);
        bss_resource.end = __pa_symbol(__bss_stop)-1;
@@ -1040,6 +1049,7 @@ void __init setup_arch(char **cmdline_p)
 
        /* after parse_early_param, so could debug it */
        insert_resource(&iomem_resource, &code_resource);
+       insert_resource(&iomem_resource, &rodata_resource);
        insert_resource(&iomem_resource, &data_resource);
        insert_resource(&iomem_resource, &bss_resource);
 
This page took 0.080206 seconds and 4 git commands to generate.