From ab6e9808b58e8d53a018a75ba9700e55e0470aad Mon Sep 17 00:00:00 2001 From: momo5502 Date: Mon, 16 May 2022 12:39:59 +0200 Subject: [PATCH] Prevent bug checks due to race conditions Zeroing the read access before the write access can result in an ept misconfiguration (page writable, but not readable) if a separate core accesses the same page inbetween the zeroing. --- src/driver/ept.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/driver/ept.cpp b/src/driver/ept.cpp index 2113f67..f333211 100644 --- a/src/driver/ept.cpp +++ b/src/driver/ept.cpp @@ -101,8 +101,8 @@ namespace vmx { if (watch_point->target_page) { - watch_point->target_page->read_access = 0; watch_point->target_page->write_access = 0; + watch_point->target_page->read_access = 0; watch_point->target_page->execute_access = 1; } @@ -261,8 +261,8 @@ namespace vmx if (!violation_qualification.ept_executable && violation_qualification.execute_access) { watch_point->target_page->execute_access = 1; - watch_point->target_page->read_access = 0; watch_point->target_page->write_access = 0; + watch_point->target_page->read_access = 0; guest_context.increment_rip = false; } else if (violation_qualification.ept_executable && (violation_qualification.read_access ||