Commit 7e09ac27 authored by Juergen Gross's avatar Juergen Gross Committed by Borislav Petkov

x86: Fix .brk attribute in linker script

Commit in Fixes added the "NOLOAD" attribute to the .brk section as a
"failsafe" measure.

Unfortunately, this leads to the linker no longer covering the .brk
section in a program header, resulting in the kernel loader not knowing
that the memory for the .brk section must be reserved.

This has led to crashes when loading the kernel as PV dom0 under Xen,
but other scenarios could be hit by the same problem (e.g. in case an
uncompressed kernel is used and the initrd is placed directly behind
it).

So drop the "NOLOAD" attribute. This has been verified to correctly
cover the .brk section by a program header of the resulting ELF file.

Fixes: e32683c6 ("x86/mm: Fix RESERVE_BRK() for older binutils")
Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Reviewed-by: default avatarJosh Poimboeuf <jpoimboe@kernel.org>
Link: https://lore.kernel.org/r/20220630071441.28576-4-jgross@suse.com
parent 38fa5479
...@@ -385,7 +385,7 @@ SECTIONS ...@@ -385,7 +385,7 @@ SECTIONS
__end_of_kernel_reserve = .; __end_of_kernel_reserve = .;
. = ALIGN(PAGE_SIZE); . = ALIGN(PAGE_SIZE);
.brk (NOLOAD) : AT(ADDR(.brk) - LOAD_OFFSET) { .brk : AT(ADDR(.brk) - LOAD_OFFSET) {
__brk_base = .; __brk_base = .;
. += 64 * 1024; /* 64k alignment slop space */ . += 64 * 1024; /* 64k alignment slop space */
*(.bss..brk) /* areas brk users have reserved */ *(.bss..brk) /* areas brk users have reserved */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment