Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions arch/riscv/kvm/vcpu_sbi_system.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,20 @@ static int kvm_sbi_ext_susp_handler(struct kvm_vcpu *vcpu, struct kvm_run *run,
return 0;
}

/*
* Check that all other vCPUs are stopped before entering
* system suspend.
*
* There is a known TOCTOU race here: a concurrent HSM
* HART_START on another vCPU can start a vCPU after it
* has already passed this check, violating the invariant.
*
* We do not fix this because:
* 1. Triggering the race requires a pathological guest.
* 2. Only guest state is at risk, not host integrity.
* 3. Userspace can double-check vCPU states before
* proceeding with suspend.
*/
kvm_for_each_vcpu(i, tmp, vcpu->kvm) {
if (tmp == vcpu)
continue;
Expand Down