mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
x86/mm: refine epte_present test
The current test for a present ept entry checks for a permission bit to be set. While this is valid in contexts in which we want to know whether an entry will fault, it is not correct when it comes to testing whether an entry is valid. Specifically, in the ept_change_entry_type_page function which is used to set entries to the log dirty type. In combination with a p2m access type like n or n2rwx, log dirty will not be set for ept entries for which it should. Reported-by: Andres Lagar-Cavilla <andres@lagarcavilla.org> Signed-off-by: Tim Deegan <tim@xen.org> Acked-by: Andres Lagar-Cavilla <andres@lagarcavilla.org> Committed-by: Tim Deegan <tim@xen.org>
This commit is contained in:
1 parent
cd00a203a5
commit
2d94bc491a
1 file changed
+5
-1
@@ -41,6 +41,10 @@
|
||||
|
||||
#define is_epte_present(ept_entry) ((ept_entry)->epte & 0x7)
|
||||
#define is_epte_superpage(ept_entry) ((ept_entry)->sp)
|
||||
static inline bool_t is_epte_valid(ept_entry_t *e)
|
||||
{
|
||||
return (e->epte != 0 && e->sa_p2mt != p2m_invalid);
|
||||
}
|
||||
|
||||
/* Non-ept "lock-and-check" wrapper */
|
||||
static int ept_pod_check_and_populate(struct p2m_domain *p2m, unsigned long gfn,
|
||||
@@ -777,7 +781,7 @@ static void ept_change_entry_type_page(mfn_t ept_page_mfn, int ept_page_level,
|
||||
|
||||
for ( int i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
|
||||
{
|
||||
if ( !is_epte_present(epte + i) )
|
||||
if ( !is_epte_valid(epte + i) )
|
||||
continue;
|
||||
|
||||
if ( (ept_page_level > 0) && !is_epte_superpage(epte + i) )
|
||||
|
||||