lkml.org 
[lkml]   [2016]   [Feb]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v3 1/2] xen/x86: Zero out .bss for PV guests
Date
Baremetal kernels clear .bss early in the boot but Xen PV guests don't
execute that code. They have been able to run without problems because
Xen domain builder happens to give out zeroed pages. However, since this
is not really guaranteed, .bss should be explicitly cleared.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: stable@vger.kernel.org
---
arch/x86/xen/xen-head.S | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git a/arch/x86/xen/xen-head.S b/arch/x86/xen/xen-head.S
index b65f59a..11dbe49 100644
--- a/arch/x86/xen/xen-head.S
+++ b/arch/x86/xen/xen-head.S
@@ -38,6 +38,20 @@
__INIT
ENTRY(startup_xen)
cld
+
+#ifdef CONFIG_X86_32
+#define WSIZE_SHIFT 2
+#else
+#define WSIZE_SHIFT 3
+#endif
+ /* Clear .bss */
+ xor %eax,%eax
+ mov $__bss_start, %__ASM_REG(di)
+ mov $__bss_stop, %__ASM_REG(cx)
+ sub %__ASM_REG(di), %__ASM_REG(cx)
+ shr $WSIZE_SHIFT, %__ASM_REG(cx)
+ rep __ASM_SIZE(stos)
+
#ifdef CONFIG_X86_32
mov %esi,xen_start_info
mov $init_thread_union+THREAD_SIZE,%esp
--
2.1.0
\
 
 \ /
  Last update: 2016-02-25 17:01    [W:0.105 / U:0.380 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site