Skip to content

Commit a8a11f0

Browse files
rustyrussellLinus Torvalds
authored andcommitted
Fix lguest bzImage loading with CONFIG_RELOCATABLE=y
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, and unfortunately, lguest doesn't go through the normal startup path (which does this in asm). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent dfbab75 commit a8a11f0

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎drivers/lguest/lguest.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,6 +1019,11 @@ __init void lguest_init(void *boot)
10191019
* the normal data segment to get through booting. */
10201020
asm volatile ("mov %0, %%fs" : : "r" (__KERNEL_DS) : "memory");
10211021

1022+
/* Clear the part of the kernel data which is expected to be zero.
1023+
* Normally it will be anyway, but if we're loading from a bzImage with
1024+
* CONFIG_RELOCATALE=y, the relocations will be sitting here. */
1025+
memset(__bss_start, 0, __bss_stop - __bss_start);
1026+
10221027
/* The Host uses the top of the Guest's virtual address space for the
10231028
* Host<->Guest Switcher, and it tells us how much it needs in
10241029
* lguest_data.reserve_mem, set up on the LGUEST_INIT hypercall. */

0 commit comments

Comments
 (0)