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

[Xen-changelog] [xen-unstable] Introduce rcu_lock_remote_target_domain_by_id().



# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1297072293 0
# Node ID 7a772fc4d92f9b04885fc2207670ecaec5c3e553
# Parent  098c8a6483c9140f82f8d39ddb5e2b7d6e394151
Introduce rcu_lock_remote_target_domain_by_id().

Signed-off-by: Keir Fraser <keir@xxxxxxx>
---
 xen/common/domain.c     |   14 ++++++++++++++
 xen/include/xen/sched.h |    7 +++++++
 2 files changed, 21 insertions(+)

diff -r 098c8a6483c9 -r 7a772fc4d92f xen/common/domain.c
--- a/xen/common/domain.c       Mon Feb 07 09:39:59 2011 +0000
+++ b/xen/common/domain.c       Mon Feb 07 09:51:33 2011 +0000
@@ -438,6 +438,20 @@ int rcu_lock_target_domain_by_id(domid_t
     return 0;
 }
 
+int rcu_lock_remote_target_domain_by_id(domid_t dom, struct domain **d)
+{
+    if ( (*d = rcu_lock_domain_by_id(dom)) == NULL )
+        return -ESRCH;
+
+    if ( (*d == current->domain) || !IS_PRIV_FOR(current->domain, *d) )
+    {
+        rcu_unlock_domain(*d);
+        return -EPERM;
+    }
+
+    return 0;
+}
+
 int domain_kill(struct domain *d)
 {
     int rc = 0;
diff -r 098c8a6483c9 -r 7a772fc4d92f xen/include/xen/sched.h
--- a/xen/include/xen/sched.h   Mon Feb 07 09:39:59 2011 +0000
+++ b/xen/include/xen/sched.h   Mon Feb 07 09:51:33 2011 +0000
@@ -435,6 +435,13 @@ struct domain *rcu_lock_domain_by_id(dom
  */
 int rcu_lock_target_domain_by_id(domid_t dom, struct domain **d);
 
+/*
+ * As rcu_lock_target_domain_by_id(), but will fail EPERM rather than resolve
+ * to local domain. Successful return always resolves to a remote domain that
+ * the local domain is privileged to control.
+ */
+int rcu_lock_remote_target_domain_by_id(domid_t dom, struct domain **d);
+
 /* Finish a RCU critical region started by rcu_lock_domain_by_id(). */
 static inline void rcu_unlock_domain(struct domain *d)
 {

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
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®.