You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(windows): prevent race between WHvCancelRunVirtualProcessor and WHvDeletePartition
kill() could call WHvCancelRunVirtualProcessor while WhpVm::drop() was calling
WHvDeletePartition, causing use-after-free crashes (STATUS_ACCESS_VIOLATION or
STATUS_HEAP_CORRUPTION).
Fix by protecting the partition handle with an RwLock. kill() takes a read lock,
and set_dropped() takes a write lock to block until all in-flight cancel calls
complete before the partition is deleted.
Signed-off-by: Ludvig Liljenberg <[email protected]>
let count:i32 = sandbox.call("GetExceptionHandlerCallCount",()).unwrap();
1665
1665
assert_eq!(count,2,"Handler should have been called twice");
1666
1666
}
1667
+
1668
+
/// This test is "likely" to catch a race condition where WHvCancelRunVirtualProcessor runs halfway, then the partition is deleted (by drop calling WHvDeletePartition),
1669
+
/// and WHvCancelRunVirtualProcessor continues, and tries to access freed memory.
1670
+
///
1671
+
/// Based on local observations, "likely" means that if the bug exist, running this test 5 times will catch it at least once.
0 commit comments