diff options
author | Jeff Dike <jdike@addtoit.com> | 2006-07-10 07:45:06 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-07-10 16:24:23 -0400 |
commit | 23bbd586ed7894982fd9323f63b2065afbb77773 (patch) | |
tree | 6fec4b69d2c4bafd134efc886f700654606c56fe /arch/um/kernel/um_arch.c | |
parent | 8633c2331e738218c7356633e1c4adb75726225f (diff) |
[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 <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/um/kernel/um_arch.c')
-rw-r--r-- | arch/um/kernel/um_arch.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c index a50a0aac8faa..7896cf98232d 100644 --- a/arch/um/kernel/um_arch.c +++ b/arch/um/kernel/um_arch.c | |||
@@ -330,6 +330,8 @@ EXPORT_SYMBOL(end_iomem); | |||
330 | 330 | ||
331 | #define MIN_VMALLOC (32 * 1024 * 1024) | 331 | #define MIN_VMALLOC (32 * 1024 * 1024) |
332 | 332 | ||
333 | extern char __binary_start; | ||
334 | |||
333 | int linux_main(int argc, char **argv) | 335 | int linux_main(int argc, char **argv) |
334 | { | 336 | { |
335 | unsigned long avail, diff; | 337 | unsigned long avail, diff; |
@@ -374,8 +376,9 @@ int linux_main(int argc, char **argv) | |||
374 | 376 | ||
375 | printf("UML running in %s mode\n", mode); | 377 | printf("UML running in %s mode\n", mode); |
376 | 378 | ||
377 | uml_start = CHOOSE_MODE_PROC(set_task_sizes_tt, set_task_sizes_skas, | 379 | uml_start = (unsigned long) &__binary_start; |
378 | &host_task_size, &task_size); | 380 | host_task_size = CHOOSE_MODE_PROC(set_task_sizes_tt, |
381 | set_task_sizes_skas, &task_size); | ||
379 | 382 | ||
380 | /* | 383 | /* |
381 | * Setting up handlers to 'sig_info' struct | 384 | * Setting up handlers to 'sig_info' struct |
@@ -395,7 +398,7 @@ int linux_main(int argc, char **argv) | |||
395 | physmem_size += UML_ROUND_UP(brk_start) - UML_ROUND_UP(&_end); | 398 | physmem_size += UML_ROUND_UP(brk_start) - UML_ROUND_UP(&_end); |
396 | } | 399 | } |
397 | 400 | ||
398 | uml_physmem = uml_start; | 401 | uml_physmem = uml_start & PAGE_MASK; |
399 | 402 | ||
400 | /* Reserve up to 4M after the current brk */ | 403 | /* Reserve up to 4M after the current brk */ |
401 | uml_reserved = ROUND_4M(brk_start) + (1 << 22); | 404 | uml_reserved = ROUND_4M(brk_start) + (1 << 22); |