CVE Details
Description
In the Linux kernel, the following vulnerability has been resolved:\nKVM: Always flush async #PF workqueue when vCPU is being destroyed\nAlways flush the per-vCPU async #PF workqueue when a vCPU is clearing its\ncompletion queue, e.g. when a VM and all its vCPUs is being destroyed.\nKVM must ensure that none of its workqueue callbacks is running when the\nlast reference to the KVM _module_ is put. Gifting a reference to the\nassociated VM prevents the workqueue callback from dereferencing freed\nvCPU/VM memory, but does not prevent the KVM module from being unloaded\nbefore the callback completes.\nDrop the misguided VM refcount gifting, as calling kvm_put_kvm() from\nasync_pf_execute() if kvm_put_kvm() flushes the async #PF workqueue will\nresult in deadlock. async_pf_execute() can't return until kvm_put_kvm()\nfinishes, and kvm_put_kvm() can't return until async_pf_execute() finishes:\nWARNING: CPU: 8 PID: 251 at virt/kvm/kvm_main.c:1435 kvm_put_kvm+0x2d/0x320 [kvm]\nModules linked in: vhost_net vhost vhost_iotlb tap kvm_intel kvm irqbypass\nCPU: 8 PID: 251 Comm: kworker/8:1 Tainted: G W 6.6.0-rc1-e7af8d17224a-x86/gmem-vm #119\nHardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015\nWorkqueue: events async_pf_execute [kvm]\nRIP: 0010:kvm_put_kvm+0x2d/0x320 [kvm]\nCall Trace:\n\nasync_pf_execute+0x198/0x260 [kvm]\nprocess_one_work+0x145/0x2d0\nworker_thread+0x27e/0x3a0\nkthread+0xba/0xe0\nret_from_fork+0x2d/0x50\nret_from_fork_asm+0x11/0x20\n\n---[ end trace 0000000000000000 ]---\nINFO: task kworker/8:1:251 blocked for more than 120 seconds.\nTainted: G W 6.6.0-rc1-e7af8d17224a-x86/gmem-vm #119\n'echo 0 > /proc/sys/kernel/hung_task_timeout_secs' disables this message.\ntask:kworker/8:1 state:D stack:0 pid:251 ppid:2 flags:0x00004000\nWorkqueue: events async_pf_execute [kvm]\nCall Trace:\n\n__schedule+0x33f/0xa40\nschedule+0x53/0xc0\nschedule_timeout+0x12a/0x140\n__wait_for_common+0x8d/0x1d0\n__flush_work.isra.0+0x19f/0x2c0\nkvm_clear_async_pf_completion_queue+0x129/0x190 [kvm]\nkvm_arch_destroy_vm+0x78/0x1b0 [kvm]\nkvm_put_kvm+0x1c1/0x320 [kvm]\nasync_pf_execute+0x198/0x260 [kvm]\nprocess_one_work+0x145/0x2d0\nworker_thread+0x27e/0x3a0\nkthread+0xba/0xe0\nret_from_fork+0x2d/0x50\nret_from_fork_asm+0x11/0x20\n\nIf kvm_clear_async_pf_completion_queue() actually flushes the workqueue,\nthen there's no need to gift async_pf_execute() a reference because all\ninvocations of async_pf_execute() will be forced to complete before the\nvCPU and its VM are destroyed/freed. And that in turn fixes the module\nunloading bug as __fput() won't do module_put() on the last vCPU reference\nuntil the vCPU has been freed, e.g. if closing the vCPU file also puts the\nlast reference to the KVM module.\nNote that kvm_check_async_pf_completion() may also take the work item off\nthe completion queue and so also needs to flush the work queue, as the\nwork will not be seen by kvm_clear_async_pf_completion_queue(). Waiting\non the workqueue could theoretically delay a vCPU due to waiting for the\nwork to complete, but that's a very, very small chance, and likely a very\nsmall delay. kvm_arch_async_page_present_queued() unconditionally makes a\nnew request, i.e. will effectively delay entering the guest, so the\nremaining work is really just:\ntrace_kvm_async_pf_completed(addr, cr2_or_gpa);\n__kvm_vcpu_wake_up(vcpu);\nmmput(mm);\nand mmput() can't drop the last reference to the page tables if the vCPU is\nstill alive, i.e. the vCPU won't get stuck tearing down page tables.\nAdd a helper to do the flushing, specifically to deal with 'wakeup all'\nwork items, as they aren't actually work items, i.e. are never placed in a\nworkqueue. Trying to flush a bogus workqueue entry rightly makes\n__flush_work() complain (kudos to whoever added that sanity check).\nNote, commit 5f6de5cbebee ('KVM: Prevent module exit until al\n---truncated---
See more information about CVE-2024-26976 from MITRE CVE dictionary and NIST NVD
CVSS Scoring
NOTE: The following CVSS v3.1 metrics and score provided are preliminary and subject to review.
Base Score: |
5.5 |
CVSS Vector: |
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H |
Attack Vector: |
Local network |
Attack Complexity: |
Low |
Privileges Required: |
Low |
User Interaction: |
None |
Scope: |
Unchanged |
Confidentiality Impact: |
None |
Integrity Impact: |
None |
Availability Impact: |
High |
Errata information