lkml.org 
[lkml]   [2016]   [Feb]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [Xen-devel] [PATCH v2] xen/x86: Zero out .bss for PV guests
From
Date
On 24/02/16 15:19, Boris Ostrovsky wrote:
> 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.
>
> (Since we introduce macros for specifying 32- and 64-bit registers we
> can get rid of ifdefs in startup_xen())
>
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Cc: stable@vger.kernel.org
> ---
> arch/x86/xen/xen-head.S | 29 ++++++++++++++++++++++-------
> 1 file changed, 22 insertions(+), 7 deletions(-)
>
> diff --git a/arch/x86/xen/xen-head.S b/arch/x86/xen/xen-head.S
> index b65f59a..2af87d1 100644
> --- a/arch/x86/xen/xen-head.S
> +++ b/arch/x86/xen/xen-head.S
> @@ -35,16 +35,31 @@
> #define PVH_FEATURES (0)
> #endif
>
> - __INIT
> -ENTRY(startup_xen)
> - cld
> #ifdef CONFIG_X86_32
> - mov %esi,xen_start_info
> - mov $init_thread_union+THREAD_SIZE,%esp
> +#define REG(register) %e##register
> +#define WSIZE_SHIFT 2
> +#define STOS stosl
> #else
> - mov %rsi,xen_start_info
> - mov $init_thread_union+THREAD_SIZE,%rsp
> +#define REG(register) %r##register
> +#define WSIZE_SHIFT 3
> +#define STOS stosq
> #endif
> +
> + __INIT
> +ENTRY(startup_xen)
> + cld
> +
> + /* Clear .bss */
> + xor REG(ax),REG(ax)

If we are nitpicking,

This should be xor %eax, %eax even in 64bit. Functionally identical,
and shorter to encode.

~Andrew

\
 
 \ /
  Last update: 2016-02-24 19:01    [W:0.069 / U:0.840 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site