summaryrefslogtreecommitdiffstats
path: root/arch/um
diff options
context:
space:
mode:
authorDavid Gow <davidgow@google.com>2020-03-05 10:39:39 -0800
committerRichard Weinberger <richard@nod.at>2020-03-29 23:21:29 +0200
commit598f5630361397c542a0ba2bec0ac5c0e1723d5c (patch)
tree3ded48a12c36cb047ff59d8f21ea27e6532aca53 /arch/um
parent73343392aae8bdd939ca58e855889d1b015b0ef4 (diff)
downloadlinux-598f5630361397c542a0ba2bec0ac5c0e1723d5c.tar.bz2
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: David Gow <davidgow@google.com> Reviewed-by: Brendan Higgins <brendanhiggins@google.com> Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'arch/um')
-rw-r--r--arch/um/kernel/uml.lds.S2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/um/kernel/uml.lds.S b/arch/um/kernel/uml.lds.S
index 9f21443be2c9..3b6dab3d4501 100644
--- a/arch/um/kernel/uml.lds.S
+++ b/arch/um/kernel/uml.lds.S
@@ -19,10 +19,10 @@ SECTIONS
__binary_start = START;
. = START + SIZEOF_HEADERS;
+ . = ALIGN(PAGE_SIZE);
_text = .;
INIT_TEXT_SECTION(0)
- . = ALIGN(PAGE_SIZE);
.text :
{