From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH v3 2/3] xen/pvh: check permissions when adding MMIO regions
Date: Fri, 23 Jan 2015 12:29:06 +0100 [thread overview]
Message-ID: <54C23082.4090605@citrix.com> (raw)
In-Reply-To: <54C128BD0200007800058515@mail.emea.novell.com>
El 22/01/15 a les 16.43, Jan Beulich ha escrit:
>>>> On 22.01.15 at 16:19, <roger.pau@citrix.com> wrote:
>> --- a/xen/arch/x86/domain_build.c
>> +++ b/xen/arch/x86/domain_build.c
>> @@ -320,11 +320,24 @@ static __init void pvh_add_mem_mapping(struct domain *d, unsigned long gfn,
>> {
>> unsigned long i;
>> p2m_access_t a;
>> + mfn_t omfn;
>> + p2m_type_t t;
>> int rc;
>>
>> - a = p2m_get_hostp2m(d)->default_access;
>
> Iirc this is rwx.
>
>> for ( i = 0; i < nr_mfns; i++ )
>> {
>> + if ( !iomem_access_permitted(d, mfn + i, mfn + i) )
>> + {
>> + omfn = get_gfn_query_unlocked(d, gfn + i, &t);
>> + guest_physmap_remove_page(d, gfn + i, mfn_x(omfn), PAGE_ORDER_4K);
>> + continue;
>> + }
>> +
>> + if ( rangeset_contains_singleton(mmio_ro_ranges, mfn + i) )
>> + a = p2m_access_r;
>> + else
>> + a = p2m_access_rw;
>
> Shouldn't these two therefore be rx and rwx respectively? Or even
> better ->default_access in the else case (albeit that doesn't really
> matter here since nothing can have changed that field from its
> default value)? I'm particularly thinking of ROMs that may be sitting
> in these areas.
Yes, it should be rx and rwx. I would prefer to use the explicit types.
IMHO it's easier to understand to which access type it's set (without
having to dig to what value p2m_get_hostp2m(d)->default_access is set).
Roger.
next prev parent reply other threads:[~2015-01-23 11:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-22 15:19 [PATCH v3 0/3] xen/pvh: prevent Dom0 from accessing reserved MMIO regions Roger Pau Monne
2015-01-22 15:19 ` [PATCH v3 1/3] xen: allow set_mmio_p2m_entry to specify access type Roger Pau Monne
2015-01-22 15:25 ` Tim Deegan
2015-01-22 15:19 ` [PATCH v3 2/3] xen/pvh: check permissions when adding MMIO regions Roger Pau Monne
2015-01-22 15:43 ` Jan Beulich
2015-01-23 11:29 ` Roger Pau Monné [this message]
2015-01-23 11:44 ` Jan Beulich
2015-01-22 20:28 ` Konrad Rzeszutek Wilk
2015-01-23 11:21 ` Jan Beulich
2015-01-23 15:04 ` Konrad Rzeszutek Wilk
2015-01-22 15:19 ` [PATCH v3 3/3] xen: prevent access to HPET from Dom0 Roger Pau Monne
2015-01-22 15:47 ` Jan Beulich
2015-01-23 11:46 ` Roger Pau Monné
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=54C23082.4090605@citrix.com \
--to=roger.pau@citrix.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.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 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.