Commit 598f5630 authored by David Gow's avatar David Gow Committed by Richard Weinberger

um: Fix overlapping ELF segments when statically linked

When statically linked, the .text section in UML kernels is not page
aligned, causing it to share a page with the executable headers. As
.text and the executable headers have different permissions, this causes
the kernel to wish to map the same page twice (once as headers with r--
permissions, once as .text with r-x permissions), causing a segfault,
and a nasty message printed to the host kernel's dmesg:

"Uhuuh, elf segment at 0000000060000000 requested but the memory is
mapped already"

By aligning the .text to a page boundary (as in the dynamically linked
version in dyn.lds.S), there is no such overlap, and the kernel runs
correctly.
Signed-off-by: default avatarDavid Gow <davidgow@google.com>
Reviewed-by: default avatarBrendan Higgins <brendanhiggins@google.com>
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
parent 73343392
...@@ -19,10 +19,10 @@ SECTIONS ...@@ -19,10 +19,10 @@ SECTIONS
__binary_start = START; __binary_start = START;
. = START + SIZEOF_HEADERS; . = START + SIZEOF_HEADERS;
. = ALIGN(PAGE_SIZE);
_text = .; _text = .;
INIT_TEXT_SECTION(0) INIT_TEXT_SECTION(0)
. = ALIGN(PAGE_SIZE);
.text : .text :
{ {
......
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