File 20026-ept-rwx-default.patch of Package xen
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1249546492 -3600
# Node ID 1e436b3752b40bbe9f0df257e09de5d7cbf8308a
# Parent 4523048f6fabddb77e62949745b599cc123be938
ept p2m: set rwx flags to 0 for invalid and mmio_dm types.
Read/write/execute flags are set to 1 before calling the type_to_flags
function which sets them to their appropriate values depending on the
p2m type. However, in invalid, mmio_dm, and default/unknown cases in
type_to_flags just falls through, unsafely leaving full access to
these pages.
Signed-off-by: Patrick Colp <Patrick.Colp@citrix.com>
--- a/xen/arch/x86/mm/hap/p2m-ept.c
+++ b/xen/arch/x86/mm/hap/p2m-ept.c
@@ -36,15 +36,16 @@ static void ept_p2m_type_to_flags(ept_en
case p2m_invalid:
case p2m_mmio_dm:
default:
+ entry->r = entry->w = entry->x = 0;
return;
case p2m_ram_rw:
case p2m_mmio_direct:
- entry->r = entry->w = entry->x = 1;
+ entry->r = entry->w = entry->x = 1;
return;
case p2m_ram_logdirty:
case p2m_ram_ro:
- entry->r = entry->x = 1;
- entry->w = 0;
+ entry->r = entry->x = 1;
+ entry->w = 0;
return;
}
}
@@ -184,7 +185,6 @@ _ept_set_entry(struct domain *d, unsigne
ept_entry->rsvd = 0;
ept_entry->avail2 = 0;
/* last step */
- ept_entry->r = ept_entry->w = ept_entry->x = 1;
ept_p2m_type_to_flags(ept_entry, p2mt);
}
else
@@ -230,7 +230,6 @@ _ept_set_entry(struct domain *d, unsigne
split_ept_entry->rsvd = 0;
split_ept_entry->avail2 = 0;
/* last step */
- split_ept_entry->r = split_ept_entry->w = split_ept_entry->x = 1;
ept_p2m_type_to_flags(split_ept_entry, split_p2mt);
}