Skip to contentSkip to conversation

Clear .bss for PV guests

PATCH Applied Boris Ostrovsky 2 participants 7 messages Feb 26, 2016 – Mar 3, 2016

Subsystems (2)
lore
Share & tools
lore

Boris Ostrovsky

author reviewer
#0 lore raw

v4 cover Clear .bss for PV guests

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)

v4:
* Better use of mode-selecting macros.
* Drop stable tag.
* Update commit message for patch 1.

Boris Ostrovsky (2):
xen/x86: Zero out .bss for PV guests xen/x86: Drop mode-selecting ifdefs in startup_xen()

 arch/x86/xen/xen-head.S | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)
Signature · 1 line
2.1.0
author reviewer
#1 lore raw

PATCH v4 1/2 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.

---
 arch/x86/xen/xen-head.S | 9 +++++++++
 1 file changed, 9 insertions(+)
arch/x86/xen/xen-head.S +9 -0
index b65f59a..5c63d2d 100644
@@ -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
Signature · 7 lines
2.1.0


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
author reviewer
#2 lore raw

PATCH v4 1/2 xen/x86: Zero out .bss for PV guests

In reply to 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.

---
 arch/x86/xen/xen-head.S | 9 +++++++++
 1 file changed, 9 insertions(+)
arch/x86/xen/xen-head.S +9 -0
index b65f59a..5c63d2d 100644
@@ -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
Signature · 1 line
2.1.0
author reviewer
#3 lore raw

PATCH v4 2/2 xen/x86: Drop mode-selecting ifdefs in startup_xen()

In reply to Boris Ostrovsky

Use asm/asm.h macros instead.

---
 arch/x86/xen/xen-head.S | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
arch/x86/xen/xen-head.S +3 -7
index 5c63d2d..de93b20 100644
@@ -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
Signature · 1 line
2.1.0
author reviewer
#4 lore raw

PATCH v4 2/2 xen/x86: Drop mode-selecting ifdefs in startup_xen()

In reply to Boris Ostrovsky

Use asm/asm.h macros instead.

---
 arch/x86/xen/xen-head.S | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
arch/x86/xen/xen-head.S +3 -7
index 5c63d2d..de93b20 100644
@@ -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
Signature · 7 lines
2.1.0


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Applied
#5 lore raw
In reply to Boris Ostrovsky
Quoted 2 lines · Boris Ostrovsky

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