From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Ian Campbell <Ian.Campbell@eu.citrix.com>,
xen-devel <xen-devel@lists.xenproject.org>,
Keir Fraser <keir@xen.org>,
Ian Jackson <Ian.Jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>
Subject: Re: [PATCH 3/3] domctl: tighten XEN_DOMCTL_*_permission
Date: Wed, 30 Apr 2014 18:17:59 +0100 [thread overview]
Message-ID: <53613047.6070608@citrix.com> (raw)
In-Reply-To: <536123B8020000780000DD61@mail.emea.novell.com>
[-- Attachment #1.1: Type: text/plain, Size: 3811 bytes --]
On 30/04/14 15:24, Jan Beulich wrote:
> With proper permission (and, for the I/O port case, wrap-around) checks
> added (note that for the I/O port case a count of zero is now being
> disallowed, in line with I/O memory handling):
>
> XEN_DOMCTL_irq_permission:
> XEN_DOMCTL_ioport_permission:
>
> Of both IRQs and I/O ports there is only a reasonably small amount, so
> there's no excess resource consumption involved here. Additionally
> they both have a specialized XSM hook associated.
>
> XEN_DOMCTL_iomem_permission:
>
> While this also has a specialized XSM hook associated (just like
> XEN_DOMCTL_{irq,ioport}_permission), it's not clear whether it's
> reasonable to expect XSM to restrict the number of ranges associated
> with a domain via this hook (which is the main resource consumption
> item here).
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>
> --- a/docs/misc/xsm-flask.txt
> +++ b/docs/misc/xsm-flask.txt
> @@ -72,9 +72,7 @@ __HYPERVISOR_domctl (xen/include/public/
> * XEN_DOMCTL_getvcpucontext
> * XEN_DOMCTL_max_vcpus
> * XEN_DOMCTL_scheduler_op
> - * XEN_DOMCTL_irq_permission
> * XEN_DOMCTL_iomem_permission
> - * XEN_DOMCTL_ioport_permission
> * XEN_DOMCTL_gethvmcontext
> * XEN_DOMCTL_sethvmcontext
> * XEN_DOMCTL_set_address_size
> --- a/xen/arch/x86/domctl.c
> +++ b/xen/arch/x86/domctl.c
> @@ -72,13 +72,11 @@ long arch_do_domctl(
> unsigned int np = domctl->u.ioport_permission.nr_ports;
> int allow = domctl->u.ioport_permission.allow_access;
>
> - ret = -EINVAL;
> - if ( (fp + np) > 65536 )
> - break;
> -
> - if ( np == 0 )
> - ret = 0;
> - else if ( xsm_ioport_permission(XSM_HOOK, d, fp, fp + np - 1, allow) )
> + if ( (fp + np - 1) < fp || (fp + np) > 0x10000 )
> + ret = -EINVAL;
> + else if ( !ioports_access_permitted(current->domain,
> + fp, fp + np - 1) ||
> + xsm_ioport_permission(XSM_HOOK, d, fp, fp + np - 1, allow) )
I don't see what the ioport permissions of the current domain have to do
with whether a domain is permitted to change the permissions for another
domain.
I would expect that any domain builder domains would have no ioport
permissions at all, which would cause this hypercall to unconditionally
fail with -EPERM even if the domain builder domain is permitted to
assign ioport permissions to the domain it is building.
~Andrew
> ret = -EPERM;
> else if ( allow )
> ret = ioports_permit_access(d, fp, fp + np - 1);
> --- a/xen/common/domctl.c
> +++ b/xen/common/domctl.c
> @@ -790,7 +790,8 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xe
>
> if ( pirq >= d->nr_pirqs )
> ret = -EINVAL;
> - else if ( xsm_irq_permission(XSM_HOOK, d, pirq, allow) )
> + else if ( !pirq_access_permitted(current->domain, pirq) ||
> + xsm_irq_permission(XSM_HOOK, d, pirq, allow) )
> ret = -EPERM;
> else if ( allow )
> ret = pirq_permit_access(d, pirq);
> @@ -809,7 +810,9 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xe
> if ( (mfn + nr_mfns - 1) < mfn ) /* wrap? */
> break;
>
> - if ( xsm_iomem_permission(XSM_HOOK, d, mfn, mfn + nr_mfns - 1, allow) )
> + if ( !iomem_access_permitted(current->domain,
> + mfn, mfn + nr_mfns - 1) ||
> + xsm_iomem_permission(XSM_HOOK, d, mfn, mfn + nr_mfns - 1, allow) )
> ret = -EPERM;
> else if ( allow )
> ret = iomem_permit_access(d, mfn, mfn + nr_mfns - 1);
>
>
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
[-- Attachment #1.2: Type: text/html, Size: 4591 bytes --]
[-- Attachment #2: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2014-04-30 17:18 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-30 14:11 [PATCH 0/3] domctl related adjustments Jan Beulich
2014-04-30 14:22 ` [PATCH 1/3] x86: fix guest CPUID handling Jan Beulich
2014-04-30 17:03 ` Andrew Cooper
2014-05-01 15:29 ` Tim Deegan
2014-04-30 14:23 ` [PATCH 2/3] domctl: perform initial post-XSA-77 auditing Jan Beulich
2014-04-30 16:52 ` Andrew Cooper
2014-05-01 15:30 ` Tim Deegan
2014-04-30 14:24 ` [PATCH 3/3] domctl: tighten XEN_DOMCTL_*_permission Jan Beulich
2014-04-30 17:17 ` Andrew Cooper [this message]
2014-05-02 7:49 ` Jan Beulich
2014-05-02 8:19 ` Ian Campbell
2014-05-02 20:34 ` Daniel De Graaf
2014-05-01 15:37 ` Tim Deegan
2014-05-02 7:41 ` Jan Beulich
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=53613047.6070608@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=Ian.Campbell@eu.citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=JBeulich@suse.com \
--cc=keir@xen.org \
--cc=tim@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.