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

Re: [Xen-users] Xen Flask make error



On 10/15/2012 03:57 AM, Ian Campbell wrote:
> On Sun, 2012-10-14 at 07:41 +0100, Yathindra wrote:
>> Hi,
>>
>> I'm trying to get flask work on Xen 4.3-unstable.
>> I enabled XSM and flask in Config.mk but make throws the following error:
>>
>> flask_op.c: In function âflask_relabel_domainâ:
>> flask_op.c:585:5: error: implicit declaration of function 
>> ârcu_lock_domain_by_any_idâ [-Werror=implicit-function-declaration]
>> flask_op.c:585:5: error: nested extern declaration of 
>> ârcu_lock_domain_by_any_idâ [-Werror=nested-externs]
>> flask_op.c:585:7: error: assignment makes pointer from integer without a 
>> cast [-Werror]
>> cc1: all warnings being treated as errors
>> make[5]: *** [flask_op.o] Error 1
>>
>> Please let me know how to resolve this error.
> 
> Daniel, any ideas?
> 

This is due to a patch from my XSM series being applied out of order
(patch 4 applied before patch 3). You can fix it by either reverting
patch 4 "xsm/flask: add domain relabel support" or by applying patch
3 "xen: Add versions of rcu_lock_*_domain without IS_PRIV checks"
- included below as it is apparently missing from xen-devel archives.

-- 
Daniel De Graaf
National Security Agency

---------------------------------->8------------------------------

These functions will be used to avoid duplication of IS_PRIV calls
that will be introduced in XSM hooks.

Signed-off-by: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
---
 xen/common/domain.c     | 21 +++++++++++++++++++++
 xen/include/xen/sched.h | 11 +++++++++++
 2 files changed, 32 insertions(+)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index a1aa05e..52489b3 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -420,6 +420,13 @@ struct domain *rcu_lock_domain_by_id(domid_t dom)
     return d;
 }
 
+struct domain *rcu_lock_domain_by_any_id(domid_t dom)
+{
+    if ( dom == DOMID_SELF )
+        return rcu_lock_current_domain();
+    return rcu_lock_domain_by_id(dom);
+}
+
 int rcu_lock_target_domain_by_id(domid_t dom, struct domain **d)
 {
     if ( dom == DOMID_SELF )
@@ -454,6 +461,20 @@ int rcu_lock_remote_target_domain_by_id(domid_t dom, 
struct domain **d)
     return 0;
 }
 
+int rcu_lock_remote_domain_by_id(domid_t dom, struct domain **d)
+{
+    if ( (*d = rcu_lock_domain_by_id(dom)) == NULL )
+        return -ESRCH;
+
+    if ( *d == current->domain )
+    {
+        rcu_unlock_domain(*d);
+        return -EPERM;
+    }
+
+    return 0;
+}
+
 int domain_kill(struct domain *d)
 {
     int rc = 0;
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 53804c8..b0def4a 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -447,6 +447,11 @@ struct domain *domain_create(
 struct domain *rcu_lock_domain_by_id(domid_t dom);
 
 /*
+ * As above function, but resolves DOMID_SELF to current domain
+ */
+struct domain *rcu_lock_domain_by_any_id(domid_t dom);
+
+/*
  * As above function, but accounts for current domain context:
  *  - Translates target DOMID_SELF into caller's domain id; and
  *  - Checks that caller has permission to act on the target domain.
@@ -460,6 +465,12 @@ int rcu_lock_target_domain_by_id(domid_t dom, struct 
domain **d);
  */
 int rcu_lock_remote_target_domain_by_id(domid_t dom, struct domain **d);
 
+/*
+ * As rcu_lock_domain_by_id(), but will fail EPERM or ESRCH rather than resolve
+ * to local domain.
+ */
+int rcu_lock_remote_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)
 {
-- 1.7.11.4



_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxx
http://lists.xen.org/xen-users

 


Rackspace

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