ANDROID: KVM: arm64: Fix races when cheking hyp_vm->id_dying
__pkvm_start_teardown_vm() can update the hyp_vm->is_dying state while
it is being observed from pkvm_load_hyp_vcpu() given that both functions
only take the VM table's read lock, hence causing a race. Fix the race
by taking the write lock from __pkvm_start_teardown_vm(), and cleanup
the unnecessary (and inconsistent) use of READ_ONCE() for
hyp_vm->is_dying while at it.
Bug: 357781595
Bug: 227300338
Bug: 278749606
Change-Id: I06b89419e01d0ac7b34a67b7de4bfb59674bceb1
Signed-off-by:
Quentin Perret <qperret@google.com>
Loading
Please sign in to comment