From b11c39c863dca88c0dc296a1145b23afe830e666 Mon Sep 17 00:00:00 2001 From: Boris Ostrovsky Date: Fri, 26 Feb 2016 14:02:36 -0500 Subject: [PATCH] xen/x86: Zero out .bss for PV guests 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 Signed-off-by: David Vrabel (cherry picked from commit 04b6b4a56884327c1648c517f1f46a2638f04c9d) Signed-off-by: Konrad Rzeszutek Wilk OraBug: 23268939 --- arch/x86/xen/xen-head.S | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/x86/xen/xen-head.S b/arch/x86/xen/xen-head.S index b65f59a358a2..5c63d2d955bb 100644 --- a/arch/x86/xen/xen-head.S +++ b/arch/x86/xen/xen-head.S @@ -38,6 +38,15 @@ __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 -- 2.50.1