mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-24 06:35:20 +00:00
vmm: tdx: Fix a deadlock while accessing vm_config
The lock to `vm_config` is held for accessing `cpus.kvm_hyperv` passing as a reference to `arch::generate_common_cpuid()`, so acquiring the same lock again while calling to the same function is a deadlock. Fixes:3793ffe888
Reported-by: Yi Wang <foxywang@tencent.com> Signed-off-by: Bo Chen <chen.bo@intel.com> (cherry picked from commitaa6e83126c
)
This commit is contained in:
parent
ab18a923f1
commit
77634a3c05
@ -1471,6 +1471,8 @@ impl Vmm {
|
||||
let vm_config = vm.get_config();
|
||||
#[cfg(all(feature = "kvm", target_arch = "x86_64"))]
|
||||
let common_cpuid = {
|
||||
#[cfg(feature = "tdx")]
|
||||
let tdx_enabled = vm_config.lock().unwrap().is_tdx_enabled();
|
||||
let phys_bits = vm::physical_bits(vm_config.lock().unwrap().cpus.max_phys_bits);
|
||||
arch::generate_common_cpuid(
|
||||
hypervisor,
|
||||
@ -1479,7 +1481,7 @@ impl Vmm {
|
||||
phys_bits,
|
||||
vm_config.lock().unwrap().cpus.kvm_hyperv,
|
||||
#[cfg(feature = "tdx")]
|
||||
vm_config.lock().unwrap().is_tdx_enabled(),
|
||||
tdx_enabled,
|
||||
)
|
||||
.map_err(|e| {
|
||||
MigratableError::MigrateReceive(anyhow!("Error generating common cpuid': {:?}", e))
|
||||
|
Loading…
Reference in New Issue
Block a user