xen/x86: Zero out .bss for PV guests
authorBoris Ostrovsky <boris.ostrovsky@oracle.com>
Fri, 26 Feb 2016 19:02:36 +0000 (14:02 -0500)
committerDavid Vrabel <david.vrabel@citrix.com>
Thu, 3 Mar 2016 16:20:09 +0000 (16:20 +0000)
ELF spec is unclear about whether .bss must me cleared by the loader.
Currently the domain builder does it when loading the guest but because
it is not (or rather may not be) guaranteed we should zero it out
explicitly.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
arch/x86/xen/xen-head.S

index b65f59a..5c63d2d 100644 (file)
        __INIT
 ENTRY(startup_xen)
        cld
+
+       /* Clear .bss */
+       xor %eax,%eax
+       mov $__bss_start, %_ASM_DI
+       mov $__bss_stop, %_ASM_CX
+       sub %_ASM_DI, %_ASM_CX
+       shr $__ASM_SEL(2, 3), %_ASM_CX
+       rep __ASM_SIZE(stos)
+
 #ifdef CONFIG_X86_32
        mov %esi,xen_start_info
        mov $init_thread_union+THREAD_SIZE,%esp