* [PATCH v4 1/2] xen/x86: Zero out .bss for PV guests
2016-02-26 19:02 [PATCH v4 0/2] Clear .bss for PV guests Boris Ostrovsky
@ 2016-02-26 19:02 ` Boris Ostrovsky
2016-02-26 19:02 ` [PATCH v4 2/2] xen/x86: Drop mode-selecting ifdefs in startup_xen() Boris Ostrovsky
2016-03-03 16:21 ` [Xen-devel] [PATCH v4 0/2] Clear .bss for PV guests David Vrabel
2 siblings, 0 replies; 4+ messages in thread
From: Boris Ostrovsky @ 2016-02-26 19:02 UTC (permalink / raw)
To: konrad.wilk, david.vrabel
Cc: xen-devel, linux-kernel, mcgrof, brgerst, andrew.cooper3,
roger.pau, Boris Ostrovsky
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>
---
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 b65f59a..5c63d2d 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.1.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v4 2/2] xen/x86: Drop mode-selecting ifdefs in startup_xen()
2016-02-26 19:02 [PATCH v4 0/2] Clear .bss for PV guests Boris Ostrovsky
2016-02-26 19:02 ` [PATCH v4 1/2] xen/x86: Zero out " Boris Ostrovsky
@ 2016-02-26 19:02 ` Boris Ostrovsky
2016-03-03 16:21 ` [Xen-devel] [PATCH v4 0/2] Clear .bss for PV guests David Vrabel
2 siblings, 0 replies; 4+ messages in thread
From: Boris Ostrovsky @ 2016-02-26 19:02 UTC (permalink / raw)
To: konrad.wilk, david.vrabel
Cc: xen-devel, linux-kernel, mcgrof, brgerst, andrew.cooper3,
roger.pau, Boris Ostrovsky
Use asm/asm.h macros instead.
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
---
arch/x86/xen/xen-head.S | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/arch/x86/xen/xen-head.S b/arch/x86/xen/xen-head.S
index 5c63d2d..de93b20 100644
--- a/arch/x86/xen/xen-head.S
+++ b/arch/x86/xen/xen-head.S
@@ -47,13 +47,9 @@ ENTRY(startup_xen)
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
-#else
- mov %rsi,xen_start_info
- mov $init_thread_union+THREAD_SIZE,%rsp
-#endif
+ mov %_ASM_SI, xen_start_info
+ mov $init_thread_union+THREAD_SIZE, %_ASM_SP
+
jmp xen_start_kernel
__FINIT
--
2.1.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Xen-devel] [PATCH v4 0/2] Clear .bss for PV guests
2016-02-26 19:02 [PATCH v4 0/2] Clear .bss for PV guests Boris Ostrovsky
2016-02-26 19:02 ` [PATCH v4 1/2] xen/x86: Zero out " Boris Ostrovsky
2016-02-26 19:02 ` [PATCH v4 2/2] xen/x86: Drop mode-selecting ifdefs in startup_xen() Boris Ostrovsky
@ 2016-03-03 16:21 ` David Vrabel
2 siblings, 0 replies; 4+ messages in thread
From: David Vrabel @ 2016-03-03 16:21 UTC (permalink / raw)
To: Boris Ostrovsky, konrad.wilk, david.vrabel
Cc: andrew.cooper3, linux-kernel, mcgrof, brgerst, xen-devel,
roger.pau
On 26/02/16 19:02, Boris Ostrovsky wrote:
> PV guests need to have their .bss zeroed out since it is not guaranteed
> to be cleared by Xen's domain builder (even if it is done so currently)
Applied to for-linus-4.6, thanks.
David
^ permalink raw reply [flat|nested] 4+ messages in thread