# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1189098282 -3600
# Node ID 453f87d6e7f085d9fb1d90e40e12a829c69876f9
# Parent 447db1235adf1bc59bbd76c951716c3df7ee8843
[XSM] correctly located update_va_mapping hook within x86 ifdefs
The following patch addresses the issue where the XSM update_va_mapping
hook was not correctly located inside the x86 ifdefs. Included are
updates for the dummy and flask modules which are also effected by
this issue.
- update_va_mapping ifdef fix for xsm
- update_va_mapping ifdef fix for dummy module
- update_va_mapping ifdef fix for flask module
Signed-off-by: George Coker <gscoker@xxxxxxxxxxxxxx>
---
xen/include/xsm/xsm.h | 12 ++++++------
xen/xsm/dummy.c | 12 ++++++------
xen/xsm/flask/hooks.c | 44 ++++++++++++++++++++++----------------------
3 files changed, 34 insertions(+), 34 deletions(-)
diff -r 447db1235adf -r 453f87d6e7f0 xen/include/xsm/xsm.h
--- a/xen/include/xsm/xsm.h Thu Sep 06 11:34:38 2007 +0100
+++ b/xen/include/xsm/xsm.h Thu Sep 06 18:04:42 2007 +0100
@@ -99,7 +99,6 @@ struct xsm_operations {
int (*memory_adjust_reservation) (struct domain *d1, struct domain *d2);
int (*memory_stat_reservation) (struct domain *d1, struct domain *d2);
int (*memory_pin_page) (struct domain *d, struct page_info *page);
- int (*update_va_mapping) (struct domain *d, l1_pgentry_t pte);
int (*console_io) (struct domain *d, int cmd);
@@ -135,6 +134,7 @@ struct xsm_operations {
int (*domain_memory_map) (struct domain *d);
int (*mmu_normal_update) (struct domain *d, intpte_t fpte);
int (*mmu_machphys_update) (struct domain *d, unsigned long mfn);
+ int (*update_va_mapping) (struct domain *d, l1_pgentry_t pte);
int (*add_to_physmap) (struct domain *d1, struct domain *d2);
#endif
};
@@ -364,11 +364,6 @@ static inline int xsm_memory_pin_page(st
static inline int xsm_memory_pin_page(struct domain *d, struct page_info *page)
{
return xsm_call(memory_pin_page(d, page));
-}
-
-static inline int xsm_update_va_mapping(struct domain *d, l1_pgentry_t pte)
-{
- return xsm_call(update_va_mapping(d, pte));
}
static inline int xsm_console_io (struct domain *d, int cmd)
@@ -528,6 +523,11 @@ static inline int xsm_mmu_machphys_updat
return xsm_call(mmu_machphys_update(d, mfn));
}
+static inline int xsm_update_va_mapping(struct domain *d, l1_pgentry_t pte)
+{
+ return xsm_call(update_va_mapping(d, pte));
+}
+
static inline int xsm_add_to_physmap(struct domain *d1, struct domain *d2)
{
return xsm_call(add_to_physmap(d1, d2));
diff -r 447db1235adf -r 453f87d6e7f0 xen/xsm/dummy.c
--- a/xen/xsm/dummy.c Thu Sep 06 11:34:38 2007 +0100
+++ b/xen/xsm/dummy.c Thu Sep 06 18:04:42 2007 +0100
@@ -187,11 +187,6 @@ static int dummy_memory_stat_reservation
return 0;
}
-static int dummy_update_va_mapping (struct domain *d, l1_pgentry_t pte)
-{
- return 0;
-}
-
static int dummy_console_io (struct domain *d, int cmd)
{
return 0;
@@ -377,6 +372,11 @@ static int dummy_mmu_normal_update (stru
}
static int dummy_mmu_machphys_update (struct domain *d, unsigned long mfn)
+{
+ return 0;
+}
+
+static int dummy_update_va_mapping (struct domain *d, l1_pgentry_t pte)
{
return 0;
}
@@ -448,7 +448,6 @@ void xsm_fixup_ops (struct xsm_operation
set_to_dummy_if_null(ops, memory_adjust_reservation);
set_to_dummy_if_null(ops, memory_stat_reservation);
set_to_dummy_if_null(ops, memory_pin_page);
- set_to_dummy_if_null(ops, update_va_mapping);
set_to_dummy_if_null(ops, console_io);
@@ -483,6 +482,7 @@ void xsm_fixup_ops (struct xsm_operation
set_to_dummy_if_null(ops, domain_memory_map);
set_to_dummy_if_null(ops, mmu_normal_update);
set_to_dummy_if_null(ops, mmu_machphys_update);
+ set_to_dummy_if_null(ops, update_va_mapping);
set_to_dummy_if_null(ops, add_to_physmap);
#endif
}
diff -r 447db1235adf -r 453f87d6e7f0 xen/xsm/flask/hooks.c
--- a/xen/xsm/flask/hooks.c Thu Sep 06 11:34:38 2007 +0100
+++ b/xen/xsm/flask/hooks.c Thu Sep 06 18:04:42 2007 +0100
@@ -407,27 +407,6 @@ static DEFINE_PER_CPU(struct percpu_mm_i
*/
#define FOREIGNDOM (this_cpu(percpu_mm_info).foreign ?: current->domain)
-static int flask_update_va_mapping(struct domain *d, l1_pgentry_t pte)
-{
- int rc = 0;
- u32 psid;
- u32 map_perms = MMU__MAP_READ;
- unsigned long mfn;
- struct domain_security_struct *dsec;
-
- dsec = d->ssid;
-
- mfn = gmfn_to_mfn(FOREIGNDOM, l1e_get_pfn(pte));
- rc = get_mfn_sid(mfn, &psid);
- if ( rc )
- return rc;
-
- if ( l1e_get_flags(pte) & _PAGE_RW )
- map_perms |= MMU__MAP_WRITE;
-
- return avc_has_perm(dsec->sid, psid, SECCLASS_MMU, map_perms, NULL);
-}
-
static int flask_console_io(struct domain *d, int cmd)
{
u32 perm;
@@ -1034,6 +1013,27 @@ static int flask_mmu_machphys_update(str
return rc;
return avc_has_perm(dsec->sid, psid, SECCLASS_MMU, MMU__UPDATEMP, NULL);
+}
+
+static int flask_update_va_mapping(struct domain *d, l1_pgentry_t pte)
+{
+ int rc = 0;
+ u32 psid;
+ u32 map_perms = MMU__MAP_READ;
+ unsigned long mfn;
+ struct domain_security_struct *dsec;
+
+ dsec = d->ssid;
+
+ mfn = gmfn_to_mfn(FOREIGNDOM, l1e_get_pfn(pte));
+ rc = get_mfn_sid(mfn, &psid);
+ if ( rc )
+ return rc;
+
+ if ( l1e_get_flags(pte) & _PAGE_RW )
+ map_perms |= MMU__MAP_WRITE;
+
+ return avc_has_perm(dsec->sid, psid, SECCLASS_MMU, map_perms, NULL);
}
static int flask_add_to_physmap(struct domain *d1, struct domain *d2)
@@ -1090,7 +1090,6 @@ static struct xsm_operations flask_ops =
.memory_adjust_reservation = flask_memory_adjust_reservation,
.memory_stat_reservation = flask_memory_stat_reservation,
.memory_pin_page = flask_memory_pin_page,
- .update_va_mapping = flask_update_va_mapping,
.console_io = flask_console_io,
@@ -1125,6 +1124,7 @@ static struct xsm_operations flask_ops =
.domain_memory_map = flask_domain_memory_map,
.mmu_normal_update = flask_mmu_normal_update,
.mmu_machphys_update = flask_mmu_machphys_update,
+ .update_va_mapping = flask_update_va_mapping,
.add_to_physmap = flask_add_to_physmap,
#endif
};
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|