All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel De Graaf <dgdegra@tycho.nsa.gov>
To: Jan Beulich <JBeulich@suse.com>
Cc: Tim Deegan <tim@xen.org>, keir@xen.org, xen-devel@lists.xen.org
Subject: Re: [PATCH 19/23] arch/x86: check remote MMIO remap permissions
Date: Tue, 18 Sep 2012 10:09:08 -0400	[thread overview]
Message-ID: <50588084.3090300@tycho.nsa.gov> (raw)
In-Reply-To: <50583D35020000780009BFB0@nat28.tlf.novell.com>

On 09/18/2012 03:21 AM, Jan Beulich wrote:
>>>> On 17.09.12 at 17:23, Daniel De Graaf <dgdegra@tycho.nsa.gov> wrote:
>> --- a/xen/arch/x86/mm.c
>> +++ b/xen/arch/x86/mm.c
>> @@ -754,6 +754,18 @@ get_page_from_l1e(
>>              return -EINVAL;
>>          }
>>  
>> +        if ( pg_owner != curr->domain &&
>> +             !iomem_access_permitted(curr->domain, mfn, mfn) )
> 
> On a second (or third?) look, I don't think this is right - the current
> domain doesn't matter here at all. What does matter is who's page
> tables the mapping is to be put in (i.e. l1e_owner), which of course
> in certain cases ends up being the current domain.
> 
> Jan

Ignoring current->domain allows a malicious domain with access to
remotely manipulate page tables to create a device mapping where the
target domain doesn't expect one. Except, now that I've said that ... 
any domain with the ability to change another domain's page tables
almost certainly can control execution in that target domain, so that
attack doesn't get you anywhere you couldn't already go.

Checking the page table owner for iomem access is useful here, I'll 
change the patch to do that. 

>> +        {
>> +            if ( mfn != (PADDR_MASK >> PAGE_SHIFT) ) /* INVALID_MFN? */
>> +            {
>> +                MEM_LOG("Domain %u attempted to map I/O space %08lx in domain %u",
>> +                        curr->domain->domain_id, mfn, pg_owner->domain_id);
>> +                return -EPERM;
>> +            }
>> +            return -EINVAL;
>> +        }
>> +
>>          if ( !(l1f & _PAGE_RW) ||
>>               !rangeset_contains_singleton(mmio_ro_ranges, mfn) )
>>              return 0;
>> -- 
>> 1.7.11.4

  reply	other threads:[~2012-09-18 14:09 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-17 15:23 [PATCH v4] Merge IS_PRIV checks into XSM hooks Daniel De Graaf
2012-09-17 15:23 ` [PATCH 01/23] xsm/flask: remove inherited class attributes Daniel De Graaf
2012-09-17 15:23 ` [PATCH 02/23] xsm/flask: remove unneeded create_sid field Daniel De Graaf
2012-09-17 15:23 ` [PATCH 03/23] xen: Add versions of rcu_lock_*_domain without IS_PRIV checks Daniel De Graaf
2012-09-17 15:23 ` [PATCH 04/23] xsm/flask: add domain relabel support Daniel De Graaf
2012-09-17 15:23 ` [PATCH 05/23] libxl: introduce XSM relabel on build Daniel De Graaf
2012-09-17 15:23 ` [PATCH 06/23] flask/policy: Add domain relabel example Daniel De Graaf
2012-09-17 15:23 ` [PATCH 07/23] arch/x86: add distinct XSM hooks for map/unmap Daniel De Graaf
2012-09-17 15:23 ` [PATCH 08/23] xsm/flask: Add checks on the domain performing the set_target operation Daniel De Graaf
2012-09-17 15:23 ` [PATCH 09/23] xsm: Use the dummy XSM module if XSM is disabled Daniel De Graaf
2012-09-17 15:23 ` [PATCH 10/23] xen: use XSM instead of IS_PRIV where duplicated Daniel De Graaf
2012-09-17 15:23 ` [PATCH 11/23] xen: avoid calling rcu_lock_*target_domain when an XSM hook exists Daniel De Graaf
2012-09-17 15:23 ` [PATCH 12/23] arch/x86: convert platform_hypercall to use XSM Daniel De Graaf
2012-09-17 15:23 ` [PATCH 13/23] xen: lock target domain in do_domctl common code Daniel De Graaf
2012-09-17 15:23 ` [PATCH 14/23] xen: convert do_domctl to use XSM Daniel De Graaf
2012-09-17 15:23 ` [PATCH 15/23] xen: convert do_sysctl " Daniel De Graaf
2012-09-17 15:23 ` [PATCH 16/23] xsm/flask: add missing hooks Daniel De Graaf
2012-09-17 15:23 ` [PATCH 17/23] xsm/flask: add distinct SIDs for self/target access Daniel De Graaf
2012-09-17 15:23 ` [PATCH 18/23] arch/x86: Add missing mem_sharing XSM hooks Daniel De Graaf
2012-09-27 13:09   ` Tim Deegan
2012-09-27 16:11     ` Daniel De Graaf
2012-09-27 16:27       ` Tim Deegan
2012-09-17 15:23 ` [PATCH 19/23] arch/x86: check remote MMIO remap permissions Daniel De Graaf
2012-09-18  7:21   ` Jan Beulich
2012-09-18 14:09     ` Daniel De Graaf [this message]
2012-09-19 17:23       ` [PATCH 19/23 v2] " Daniel De Graaf
2012-09-20  6:52         ` Jan Beulich
2012-09-24 14:14           ` [PATCH v3] " Daniel De Graaf
2012-09-17 15:23 ` [PATCH 20/23] arch/x86: use XSM hooks for get_pg_owner access checks Daniel De Graaf
2012-09-17 15:23 ` [PATCH 21/23] xen: Add XSM hook for XENMEM_exchange Daniel De Graaf
2012-09-17 15:23 ` [PATCH 22/23] tmem: add XSM hooks Daniel De Graaf
2012-09-17 15:23 ` [PATCH 23/23] xen/arch/*: add struct domain parameter to arch_do_domctl Daniel De Graaf

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=50588084.3090300@tycho.nsa.gov \
    --to=dgdegra@tycho.nsa.gov \
    --cc=JBeulich@suse.com \
    --cc=keir@xen.org \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.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.