xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>,
	xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH 3/3] x86: tighten MMU_*PT_UPDATE* check and combine error paths
Date: Thu, 12 Oct 2017 12:31:58 +0100	[thread overview]
Message-ID: <6f356ca2-1c0e-e050-0ac5-fd98da5bc3a6@citrix.com> (raw)
In-Reply-To: <59DF59870200007800185560@prv-mh.provo.novell.com>

On 12/10/17 11:01, Jan Beulich wrote:
> Don't accept anything other than r/w RAM pages and move the paged-out
> check into the (unlikely) error path following that check.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

How does dom0 boot with this change in place?  You appear to have
prohibited mapping MMIO frames.

~Andrew

>
> --- a/xen/arch/x86/mm.c
> +++ b/xen/arch/x86/mm.c
> @@ -3507,18 +3507,18 @@ long do_mmu_update(
>              gmfn = req.ptr >> PAGE_SHIFT;
>              page = get_page_from_gfn(pt_owner, gmfn, &p2mt, P2M_ALLOC);
>  
> -            if ( p2m_is_paged(p2mt) )
> +            if ( unlikely(!page) || p2mt != p2m_ram_rw )
>              {
> -                ASSERT(!page);
> -                p2m_mem_paging_populate(pt_owner, gmfn);
> -                rc = -ENOENT;
> -                break;
> -            }
> -
> -            if ( unlikely(!page) )
> -            {
> -                gdprintk(XENLOG_WARNING,
> -                         "Could not get page for normal update\n");
> +                if ( page )
> +                    put_page(page);
> +                if ( p2m_is_paged(p2mt) )
> +                {
> +                    p2m_mem_paging_populate(pt_owner, gmfn);
> +                    rc = -ENOENT;
> +                }
> +                else
> +                    gdprintk(XENLOG_WARNING,
> +                             "Could not get page for normal update\n");
>                  break;
>              }
>  
>
>
>


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2017-10-12 11:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-12  9:38 [PATCH 0/3] x86: adjustments to page table updates Jan Beulich
2017-10-12 10:00 ` [PATCH 1/3] x86: request page table page-in for the correct domain Jan Beulich
2017-10-12 10:02   ` Andrew Cooper
2017-10-12 10:00 ` [PATCH 2/3] x86: fix do_update_va_mapping_otherdomain() wrt translated domains Jan Beulich
2017-10-12 11:18   ` Andrew Cooper
2017-10-12 11:27     ` Jan Beulich
2017-10-12 10:01 ` [PATCH 3/3] x86: tighten MMU_*PT_UPDATE* check and combine error paths Jan Beulich
2017-10-12 11:31   ` Andrew Cooper [this message]
2017-10-12 12:14     ` Jan Beulich
2017-12-04 16:26       ` Andrew Cooper
2017-12-04 10:41   ` Ping: " Jan Beulich
2017-10-12 12:24 ` [PATCH 4/3] x86: don't ignore foreigndom on L2/L3/L4 page table updates Jan Beulich
2017-12-04 10:42   ` Ping: " Jan Beulich
2017-12-04 16:28   ` Andrew Cooper
2017-10-13  9:43 ` [PATCH 0/3] x86: adjustments to " Julien Grall

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=6f356ca2-1c0e-e050-0ac5-fd98da5bc3a6@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).