[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen stable-4.4] xsm/evtchn: never pretend to have successfully created a Xen event channel



commit d0bc9ab7a164665a6a9fc35e9514ff67d18008d1
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Tue Feb 3 12:31:31 2015 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Feb 3 12:31:31 2015 +0100

    xsm/evtchn: never pretend to have successfully created a Xen event channel
    
    Xen event channels are not internal resources.  They still have one end in a
    domain, and are created at the request of privileged domains.  This logic
    which "successfully" creates a Xen event channel opens up undesirable 
failure
    cases with ill-specified XSM policies.
    
    If a domain is permitted to create ioreq servers or memevent listeners, but
    not to create event channels, the ioreq/memevent creation will succeed but
    attempting to bind the returned event channel will fail without any 
indication
    of a permission error.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Acked-by: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
    master commit: 09aa4759faa29c1fe735266de4c79f17329bd67b
    master date: 2015-01-20 10:42:26 +0100
---
 xen/common/event_channel.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index 6fd4a2c..2774cbb 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -1140,21 +1140,25 @@ int alloc_unbound_xen_event_channel(
 
     spin_lock(&d->event_lock);
 
-    if ( (port = get_free_port(d)) < 0 )
+    rc = get_free_port(d);
+    if ( rc < 0 )
         goto out;
+    port = rc;
     chn = evtchn_from_port(d, port);
 
     rc = xsm_evtchn_unbound(XSM_TARGET, d, chn, remote_domid);
+    if ( rc )
+        goto out;
 
     chn->state = ECS_UNBOUND;
     chn->xen_consumer = get_xen_consumer(notification_fn);
     chn->notify_vcpu_id = local_vcpu->vcpu_id;
-    chn->u.unbound.remote_domid = !rc ? remote_domid : DOMID_INVALID;
+    chn->u.unbound.remote_domid = remote_domid;
 
  out:
     spin_unlock(&d->event_lock);
 
-    return port;
+    return rc < 0 ? rc : port;
 }
 
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.4

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.