[tip: x86/build] x86/mm: Report actual image regions in /proc/iomem
tip-bot2 for Kees Cook
tip-bot2 at linutronix.de
Tue Nov 5 20:27:26 AEDT 2019
The following commit has been merged into the x86/build branch of tip:
Commit-ID: a329975491aafcb1fb6e2fad0de22cae5c16154f
Gitweb: https://git.kernel.org/tip/a329975491aafcb1fb6e2fad0de22cae5c16154f
Author: Kees Cook <keescook at chromium.org>
AuthorDate: Tue, 29 Oct 2019 14:13:50 -07:00
Committer: Borislav Petkov <bp at suse.de>
CommitterDate: Mon, 04 Nov 2019 19:02:25 +01:00
x86/mm: Report actual image regions in /proc/iomem
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 <keescook at chromium.org>
Signed-off-by: Borislav Petkov <bp at suse.de>
Cc: Andy Lutomirski <luto at kernel.org>
Cc: Arnd Bergmann <arnd at arndb.de>
Cc: Dave Hansen <dave.hansen at linux.intel.com>
Cc: Dave Young <dyoung at redhat.com>
Cc: David Howells <dhowells at redhat.com>
Cc: Heiko Carstens <heiko.carstens at de.ibm.com>
Cc: "H. Peter Anvin" <hpa at zytor.com>
Cc: Ingo Molnar <mingo at redhat.com>
Cc: Juergen Gross <jgross at suse.com>
Cc: linux-alpha at vger.kernel.org
Cc: linux-arch at vger.kernel.org
Cc: linux-arm-kernel at lists.infradead.org
Cc: linux-c6x-dev at linux-c6x.org
Cc: linux-ia64 at vger.kernel.org
Cc: linuxppc-dev at lists.ozlabs.org
Cc: linux-s390 at vger.kernel.org
Cc: Michael Ellerman <mpe at ellerman.id.au>
Cc: Michal Simek <monstr at monstr.eu>
Cc: Rick Edgecombe <rick.p.edgecombe at intel.com>
Cc: Robert Richter <rrichter at marvell.com>
Cc: Segher Boessenkool <segher at kernel.crashing.org>
Cc: Thomas Gleixner <tglx at linutronix.de>
Cc: Thomas Lendacky <Thomas.Lendacky at amd.com>
Cc: Will Deacon <will at kernel.org>
Cc: x86-ml <x86 at kernel.org>
Cc: Yoshinori Sato <ysato at users.sourceforge.jp>
Link: https://lkml.kernel.org/r/20191029211351.13243-29-keescook@chromium.org
---
arch/x86/kernel/setup.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 77ea96b..591e885 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -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);
More information about the Linuxppc-dev
mailing list