From 23bbd586ed7894982fd9323f63b2065afbb77773 Mon Sep 17 00:00:00 2001 From: Jeff Dike Date: Mon, 10 Jul 2006 04:45:06 -0700 Subject: [PATCH] uml: fix static binary segfault When UML is built as a static binary, it segfaults when run. The reason is that a memory hole that is present in dynamic binaries isn't there in static binaries, and it contains essential stuff. This fix removes the code which maps some anonymous memory into that hole and cleans up some related code. Signed-off-by: Jeff Dike Cc: Paolo 'Blaisorblade' Giarrusso Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/um/kernel/um_arch.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'arch/um/kernel/um_arch.c') diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c index a50a0aac8fa..7896cf98232 100644 --- a/arch/um/kernel/um_arch.c +++ b/arch/um/kernel/um_arch.c @@ -330,6 +330,8 @@ EXPORT_SYMBOL(end_iomem); #define MIN_VMALLOC (32 * 1024 * 1024) +extern char __binary_start; + int linux_main(int argc, char **argv) { unsigned long avail, diff; @@ -374,8 +376,9 @@ int linux_main(int argc, char **argv) printf("UML running in %s mode\n", mode); - uml_start = CHOOSE_MODE_PROC(set_task_sizes_tt, set_task_sizes_skas, - &host_task_size, &task_size); + uml_start = (unsigned long) &__binary_start; + host_task_size = CHOOSE_MODE_PROC(set_task_sizes_tt, + set_task_sizes_skas, &task_size); /* * Setting up handlers to 'sig_info' struct @@ -395,7 +398,7 @@ int linux_main(int argc, char **argv) physmem_size += UML_ROUND_UP(brk_start) - UML_ROUND_UP(&_end); } - uml_physmem = uml_start; + uml_physmem = uml_start & PAGE_MASK; /* Reserve up to 4M after the current brk */ uml_reserved = ROUND_4M(brk_start) + (1 << 22); -- cgit v1.2.3