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

[win-pv-devel] [PATCH] Make sure Mdl->StartVa is set by __AllocatePages()



wdm.h carries this comment:

// Notice that while in the context of the subject thread, the base virtual
// address of a buffer mapped by an MDL may be referenced using the
// following:
//
//      Mdl->StartVa | Mdl->ByteOffset
//

Hence it is important then a mapped MDL has a valid StartVa field as well
as a valid MappedSystemVa field. Unfortunately, for reasons best known to
Microsoft, MmMapLockedPagesSpecifyCache() does not ensure this is the
case, so it needs to be fixed up by __AllocatePages() itself.

Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
---
 src/common/util.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/common/util.h b/src/common/util.h
index 9175e9b..52b4d42 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -219,7 +219,11 @@ __AllocatePages(
     if (MdlMappedSystemVa == NULL)
         goto fail3;
 
-    ASSERT3P(MdlMappedSystemVa, ==, Mdl->MappedSystemVa);
+    Mdl->StartVa = PAGE_ALIGN(MdlMappedSystemVa);
+
+    ASSERT3U(Mdl->ByteOffset, ==, 0);
+    ASSERT3P(Mdl->StartVa, ==, MdlMappedSystemVa);
+    ASSERT3P(Mdl->MappedSystemVa, ==, MdlMappedSystemVa);
 
     RtlZeroMemory(MdlMappedSystemVa, Mdl->ByteCount);
 
-- 
2.5.3


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/win-pv-devel

 


Rackspace

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