[lkml]   [2020]   [Mar]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH] 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, there is no such overlap, and the kernel runs

Signed-off-by: David Gow <>
I'm not 100% sure what triggered this -- possibly a change to the host
kernel on my machine -- as I'm able to reproduce the issue as far back
as in 4.4, but it seems to be reproducible easily on my machine with
defconfig + CONFIG_STATIC_LINK=y.

arch/um/kernel/ | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/um/kernel/ b/arch/um/kernel/
index 9f21443be2c9..3b6dab3d4501 100644
--- a/arch/um/kernel/
+++ b/arch/um/kernel/
@@ -19,10 +19,10 @@ SECTIONS
__binary_start = START;


_text = .;

.text :
 \ /
  Last update: 2020-03-05 19:40    [W:0.062 / U:1.392 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site