mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Fix lguest bzImage loading with CONFIG_RELOCATABLE=y
@ 2007-07-27  3:35 Rusty Russell
  2007-07-27 10:45 ` Andi Kleen
  0 siblings, 1 reply; 3+ messages in thread
From: Rusty Russell @ 2007-07-27  3:35 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: lguest, Andrew Morton, lkml - Kernel Mailing List

Jason Yeh sent his crashing .config: bzImages made with
CONFIG_RELOCATABLE=y put the relocs where the BSS is expected, and we
crash with unusual results such as:

	lguest: unhandled trap 14 at 0xc0122ae1 (0xa9)

Relying on BSS being zero was merely laziness on my part.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

diff -r cf2bfb364110 drivers/lguest/lguest.c
--- a/drivers/lguest/lguest.c	Fri Jul 27 13:04:22 2007 +1000
+++ b/drivers/lguest/lguest.c	Fri Jul 27 13:15:22 2007 +1000
@@ -1039,6 +1039,11 @@ __init void lguest_init(void *boot)
 	 * the normal data segment to get through booting. */
 	asm volatile ("mov %0, %%fs" : : "r" (__KERNEL_DS) : "memory");
 
+	/* Clear the part of the kernel data which is expected to be zero.
+	 * Normally it will be anyway, but if we're loading from a bzImage with
+	 * CONFIG_RELOCATALE=y, the relocations will be sitting here. */
+	memset(__bss_start, 0, __bss_stop - __bss_start);
+
 	/* The Host uses the top of the Guest's virtual address space for the
 	 * Host<->Guest Switcher, and it tells us how much it needs in
 	 * lguest_data.reserve_mem, set up on the LGUEST_INIT hypercall. */



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix lguest bzImage loading with CONFIG_RELOCATABLE=y
  2007-07-27  3:35 [PATCH] Fix lguest bzImage loading with CONFIG_RELOCATABLE=y Rusty Russell
@ 2007-07-27 10:45 ` Andi Kleen
  2007-07-29  0:23   ` Rusty Russell
  0 siblings, 1 reply; 3+ messages in thread
From: Andi Kleen @ 2007-07-27 10:45 UTC (permalink / raw)
  To: Rusty Russell
  Cc: Linus Torvalds, lguest, Andrew Morton, lkml - Kernel Mailing List

Rusty Russell <rusty@rustcorp.com.au> writes:

> Jason Yeh sent his crashing .config: bzImages made with
> CONFIG_RELOCATABLE=y put the relocs where the BSS is expected, and we
> crash with unusual results such as:

The normal kernel startup should already clear BSS. Why does
this not work here? Can it be fixed?

-Andi

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix lguest bzImage loading with CONFIG_RELOCATABLE=y
  2007-07-27 10:45 ` Andi Kleen
@ 2007-07-29  0:23   ` Rusty Russell
  0 siblings, 0 replies; 3+ messages in thread
From: Rusty Russell @ 2007-07-29  0:23 UTC (permalink / raw)
  To: Andi Kleen
  Cc: Linus Torvalds, lguest, Andrew Morton, lkml - Kernel Mailing List

On Fri, 2007-07-27 at 12:45 +0200, Andi Kleen wrote:
> Rusty Russell <rusty@rustcorp.com.au> writes:
> 
> > Jason Yeh sent his crashing .config: bzImages made with
> > CONFIG_RELOCATABLE=y put the relocs where the BSS is expected, and we
> > crash with unusual results such as:
> 
> The normal kernel startup should already clear BSS. Why does
> this not work here? Can it be fixed?

Unfortunately, lguest doesn't go through the normal startup path (which
does this in asm).

Thanks,
Rusty.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-07-29  0:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-27  3:35 [PATCH] Fix lguest bzImage loading with CONFIG_RELOCATABLE=y Rusty Russell
2007-07-27 10:45 ` Andi Kleen
2007-07-29  0:23   ` Rusty Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®