]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ARM: 8583/1: mm: fix location of _etext
authorKees Cook <keescook@chromium.org>
Thu, 23 Jun 2016 20:28:47 +0000 (21:28 +0100)
committerRussell King <rmk+kernel@armlinux.org.uk>
Sat, 2 Jul 2016 10:01:30 +0000 (11:01 +0100)
The _etext position is defined to be the end of the kernel text code,
and should not include any part of the data segments. This interferes
with things that might check memory ranges and expect executable code
up to _etext. Just to be conservative, leave the kernel resource as
it was, using __init_begin instead of _etext as the end mark.

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/kernel/setup.c
arch/arm/kernel/vmlinux.lds.S

index 7b5350060612786c566d6f96cbffa2f444a91453..dd84f03dc2d40755576b1b1a97af908f32725489 100644 (file)
@@ -844,7 +844,7 @@ static void __init request_standard_resources(const struct machine_desc *mdesc)
        struct resource *res;
 
        kernel_code.start   = virt_to_phys(_text);
-       kernel_code.end     = virt_to_phys(_etext - 1);
+       kernel_code.end     = virt_to_phys(__init_begin - 1);
        kernel_data.start   = virt_to_phys(_sdata);
        kernel_data.end     = virt_to_phys(_end - 1);
 
index e2c6da096cefa491669ae8b4464b89f6df5f0a75..99420fc1f066796fdec9ea5a473a0d893647379b 100644 (file)
@@ -125,6 +125,8 @@ SECTIONS
 #ifdef CONFIG_DEBUG_ALIGN_RODATA
        . = ALIGN(1<<SECTION_SHIFT);
 #endif
+       _etext = .;                     /* End of text section */
+
        RO_DATA(PAGE_SIZE)
 
        . = ALIGN(4);
@@ -155,8 +157,6 @@ SECTIONS
 
        NOTES
 
-       _etext = .;                     /* End of text and rodata section */
-
 #ifdef CONFIG_DEBUG_RODATA
        . = ALIGN(1<<SECTION_SHIFT);
 #else