All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>, Keir Fraser <keir@xen.org>
Subject: Re: [PATCH 4/4] x86: check for canonical address before doing page walks
Date: Thu, 10 Oct 2013 15:01:54 +0100	[thread overview]
Message-ID: <5256B352.1050307@citrix.com> (raw)
In-Reply-To: <5256CDEE02000078000FA3EE@nat28.tlf.novell.com>

On 10/10/13 14:55, Jan Beulich wrote:
> ... as there doesn't really exists any valid mapping for them.
>
> Particularly in the case of do_page_walk() this also avoids returning
> non-NULL for such invalid input.
>
> Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>
> --- a/xen/arch/x86/x86_64/mm.c
> +++ b/xen/arch/x86/x86_64/mm.c
> @@ -73,7 +73,7 @@ void *do_page_walk(struct vcpu *v, unsig
>      l2_pgentry_t l2e, *l2t;
>      l1_pgentry_t l1e, *l1t;
>  
> -    if ( is_hvm_vcpu(v) )
> +    if ( is_hvm_vcpu(v) || !is_canonical_address(addr) )
>          return NULL;
>  
>      l4t = map_domain_page(mfn);
> --- a/xen/arch/x86/x86_64/traps.c
> +++ b/xen/arch/x86/x86_64/traps.c
> @@ -170,6 +170,8 @@ void show_page_walk(unsigned long addr)
>      l1_pgentry_t l1e, *l1t;
>  
>      printk("Pagetable walk from %016lx:\n", addr);
> +    if ( !is_canonical_address(addr) )
> +        return;
>  
>      l4t = map_domain_page(mfn);
>      l4e = l4t[l4_table_offset(addr)];
>

I was intending something a little more like

if ( !is_canonical_address(addr) )
{
    printk(" Not canonical\n");
    return;
}

So it doesn't appear on the console that show_page_walk() got stuck
somewhere.

~Andrew

  reply	other threads:[~2013-10-10 14:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-10 13:49 [PATCH 0/4] x86: XSA-67 follow-up Jan Beulich
2013-10-10 13:53 ` [PATCH 1/4] x86: correct LDT checks Jan Beulich
2013-10-10 13:54 ` [PATCH 2/4] x86: add address validity check to guest_map_l1e() Jan Beulich
2013-10-10 13:57   ` Andrew Cooper
2013-10-10 13:54 ` [PATCH 3/4] x86: use {rd, wr}{fs, gs}base when available Jan Beulich
2013-10-10 14:15   ` Andrew Cooper
2013-10-10 13:55 ` [PATCH 4/4] x86: check for canonical address before doing page walks Jan Beulich
2013-10-10 14:01   ` Andrew Cooper [this message]
2013-10-10 14:10     ` Jan Beulich
2013-10-10 14:17       ` Andrew Cooper
2013-10-10 15:13 ` [PATCH 0/4] x86: XSA-67 follow-up Keir Fraser

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=5256B352.1050307@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=keir@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.