Skip to content

Conversation

@ludfjig
Copy link
Contributor

@ludfjig ludfjig commented Dec 10, 2025

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.

@ludfjig ludfjig added the kind/bugfix For PRs that fix bugs label Dec 10, 2025
…HvDeletePartition

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]>
@simongdavies simongdavies merged commit 8ceef49 into hyperlight-dev:main Dec 10, 2025
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bugfix For PRs that fix bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants