From: Julien Grall <julien.grall@linaro.org>
To: Jan Beulich <JBeulich@suse.com>,
xen-devel <xen-devel@lists.xenproject.org>
Cc: Ian Campbell <Ian.Campbell@eu.citrix.com>,
Tim Deegan <tim@xen.org>, Keir Fraser <keir@xen.org>,
Ian Jackson <Ian.Jackson@eu.citrix.com>
Subject: Re: [PATCH] domctl: fix IRQ permission granting/revocation
Date: Wed, 10 Dec 2014 10:19:53 +0000 [thread overview]
Message-ID: <54881E49.7090009@linaro.org> (raw)
In-Reply-To: <54880D6B020000780004E6AA@mail.emea.novell.com>
Hi Jan,
On 10/12/2014 08:07, Jan Beulich wrote:
> Commit 545607eb3c ("x86: fix various issues with handling guest IRQs")
> wasn't really consistent in one respect: The granting of access to an
> IRQ shouldn't assume the pIRQ->IRQ translation to be the same in both
> domains. In fact it is wrong to assume that a translation is already/
> still in place at the time access is being granted/revoked.
With the change to the interface, some part of libxl may misuse
xc_domain_irq_permission. For instance in tools/libxl/libxl_create.c:
1178 ret = irq >= 0 ? xc_physdev_map_pirq(CTX->xch, domid, irq,
&irq)
We get the PIRQ of domain domid in irq.
1179 : -EOVERFLOW;
1180 if (!ret)
1181 ret = xc_domain_irq_permission(CTX->xch, domid, irq,
1)
Here, the PIRQ of the current domain should be passed. Fortunately, for
this specific case, the PIRQs are the same. But this is confusing.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>
> --- a/xen/common/domctl.c
> +++ b/xen/common/domctl.c
> @@ -981,18 +981,18 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xe
>
> case XEN_DOMCTL_irq_permission:
> {
> - unsigned int pirq = op->u.irq_permission.pirq;
> + unsigned int pirq = op->u.irq_permission.pirq, irq;
> int allow = op->u.irq_permission.allow_access;
>
> if ( pirq >= d->nr_pirqs )
> ret = -EINVAL;
> - else if ( !pirq_access_permitted(current->domain, pirq) ||
> + else if ( !(irq = pirq_access_permitted(current->domain, pirq)) ||
> xsm_irq_permission(XSM_HOOK, d, pirq, allow) )
As the pirq may not be the same in domain d, the XSM permission is wrong
here.
In anycase, it looks weird to use pirq here because the guy who defines
the policy may not know the PIRQ value.
Regards,
--
Julien Grall
next prev parent reply other threads:[~2014-12-10 10:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-10 8:07 [PATCH] domctl: fix IRQ permission granting/revocation Jan Beulich
2014-12-10 9:53 ` Ian Campbell
2014-12-10 10:00 ` Jan Beulich
2014-12-10 10:12 ` Ian Campbell
2014-12-11 11:44 ` Jan Beulich
2014-12-11 17:40 ` Daniel De Graaf
2014-12-10 10:19 ` Julien Grall [this message]
2014-12-10 10:46 ` 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=54881E49.7090009@linaro.org \
--to=julien.grall@linaro.org \
--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.