lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMzpN2i_5+-tNfUGyV0s6tYbb=MyPxN_7toP-t=Hb1iqOMg1Tg@mail.gmail.com>
Date:	Thu, 25 Feb 2016 11:12:58 -0500
From:	Brian Gerst <brgerst@...il.com>
To:	Boris Ostrovsky <boris.ostrovsky@...cle.com>
Cc:	Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
	David Vrabel <david.vrabel@...rix.com>,
	xen-devel@...ts.xenproject.org,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	mcgrof@...nel.org, andrew.cooper3@...rix.com,
	stable <stable@...r.kernel.org>
Subject: Re: [PATCH v3 1/2] xen/x86: Zero out .bss for PV guests

On Thu, Feb 25, 2016 at 10:16 AM, Boris Ostrovsky
<boris.ostrovsky@...cle.com> 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.
>
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@...cle.com>
> Cc: stable@...r.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

Better, but can still be improved.  Replace WSIZE_SHIFT with
__ASM_SEL(2, 3), and use the macros for the registers (ie. __ASM_DI).

--
Brian Gerst

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ