mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>,
	Ian Campbell <Ian.Campbell@citrix.com>,
	"mukesh.rathor@oracle.com" <mukesh.rathor@oracle.com>
Subject: Re: [PATCH 02/10] xen/pvh: Fix PVHVM 32-bit bootup problems.
Date: Wed, 24 Oct 2012 12:01:09 +0100	[thread overview]
Message-ID: <alpine.DEB.2.02.1210241159230.2689@kaball.uk.xensource.com> (raw)
In-Reply-To: <1351015931-16991-3-git-send-email-konrad.wilk@oracle.com>

On Tue, 23 Oct 2012, Konrad Rzeszutek Wilk wrote:
> With the split of the 'unsigned int space' in a 'u16 space'
> and 'u16 foreign_domid' in xen_add_to_physmap the compiler
> won't write the full 32-bit value in 'space'. Instead
> it will write a 16-bit value - which is OK. The problem
> is that we allocate the xen_add_to_physmap structure from
> the stack which can (and it has) various garbage on it.
> 
> The end result is that without this patch we end up
> providing this to the hypervisor:
> 
>    xatp.space = 0xc1310001;
> instead of:
>    xatp.space = 0x1;
> 
> Forcing the foreign_domid to 0, will over-write the garbage
> that was on the stack.
> 
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

Good fix.


>  arch/x86/xen/enlighten.c  |    1 +
>  drivers/xen/grant-table.c |    1 +
>  2 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
> index e3497f2..b679f86 100644
> --- a/arch/x86/xen/enlighten.c
> +++ b/arch/x86/xen/enlighten.c
> @@ -1509,6 +1509,7 @@ void __ref xen_hvm_init_shared_info(void)
>  	xatp.domid = DOMID_SELF;
>  	xatp.idx = 0;
>  	xatp.space = XENMAPSPACE_shared_info;
> +	xatp.foreign_domid = 0;
>  	xatp.gpfn = __pa(shared_info_page) >> PAGE_SHIFT;
>  	if (HYPERVISOR_memory_op(XENMEM_add_to_physmap, &xatp))
>  		BUG();
> diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
> index b2b0a37..cbfd929 100644
> --- a/drivers/xen/grant-table.c
> +++ b/drivers/xen/grant-table.c
> @@ -1044,6 +1044,7 @@ static int gnttab_map(unsigned int start_idx, unsigned int end_idx)
>  		do {
>  			xatp.domid = DOMID_SELF;
>  			xatp.idx = i;
> +			xatp.foreign_domid = 0;
>  			xatp.space = XENMAPSPACE_grant_table;
>  			xatp.gpfn = (xen_hvm_resume_frames >> PAGE_SHIFT) + i;
>  			rc = HYPERVISOR_memory_op(XENMEM_add_to_physmap, &xatp);
> -- 
> 1.7.7.6
> 

  reply	other threads:[~2012-10-24 11:01 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-23 18:12 [PATCH V5] PVH patches for v3.8 Konrad Rzeszutek Wilk
2012-10-23 18:12 ` [PATCH 01/10] xen/pvh: Support ParaVirtualized Hardware extensions Konrad Rzeszutek Wilk
2012-10-24  9:37   ` Ian Campbell
2012-10-29 13:46     ` Konrad Rzeszutek Wilk
2012-10-23 18:12 ` [PATCH 02/10] xen/pvh: Fix PVHVM 32-bit bootup problems Konrad Rzeszutek Wilk
2012-10-24 11:01   ` Stefano Stabellini [this message]
2012-10-23 18:12 ` [PATCH 03/10] xen/hypercall: Make xen_remove_from_physmap the same on 64/32 builds Konrad Rzeszutek Wilk
2012-10-24  9:40   ` Ian Campbell
2012-10-24 11:02     ` Stefano Stabellini
2012-10-29 13:50     ` Konrad Rzeszutek Wilk
2012-10-23 18:12 ` [PATCH 04/10] xen/smp: Move the common CPU init code a bit to prep for PVH patch Konrad Rzeszutek Wilk
2012-10-23 18:12 ` [PATCH 05/10] xen/pvh: Extend vcpu_guest_context, p2m, event, and XenBus Konrad Rzeszutek Wilk
2012-10-24  9:49   ` Ian Campbell
2012-10-23 18:12 ` [PATCH 06/10] xen/pvh: Implement MMU changes for PVH Konrad Rzeszutek Wilk
2012-10-23 18:12 ` [PATCH 07/10] xen/pvh: bootup and setup (E820) related changes Konrad Rzeszutek Wilk
2012-10-23 18:12 ` [PATCH 08/10] xen/e820: Coalesce the PVH release/populate logic in the generic case Konrad Rzeszutek Wilk
2012-10-23 18:12 ` [PATCH 09/10] xen/pvh: balloon and grant changes Konrad Rzeszutek Wilk
2012-10-23 18:12 ` [PATCH 10/10] xen/pvh: /dev/xen/privcmd changes Konrad Rzeszutek Wilk
2012-10-24  7:13 ` [Xen-devel] [PATCH V5] PVH patches for v3.8 Jan Beulich
2012-10-24  9:34   ` Ian Campbell
2012-10-24  9:44     ` Jan Beulich
2012-10-24  9:53       ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.02.1210241159230.2689@kaball.uk.xensource.com \
    --to=stefano.stabellini@eu.citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mukesh.rathor@oracle.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®