UBUNTU-CVE-2025-71104
In the Linux kernel, the following vulnerability has been resolved: KVM: x86: Fix VM hard lockup after prolonged inactivity with periodic HV timer When advancing the target expiration for the guest's APIC timer in periodic mode, set the expiration to "now" if the target expiration is in the past (similar to what is done in update_target_expiration()). Blindly adding the period to the previous target expiration can result in KVM generating a practically unbounded number of hrtimer IRQs due to programming an expired timer over and over. In extreme scenarios, e.g. if userspace pauses/suspends a VM for an extended duration, this can even cause hard lockups in the host. Currently, the bug only affects Intel CPUs when using the hypervisor timer (HV timer), a.k.a. the VMX preemption timer. Unlike the software timer, a.k.a. hrtimer, which KVM keeps running even on exits to userspace, the HV timer only runs while the guest is active. As a result, if the vCPU does not run for an extended duration, there will be a huge gap between the target expiration and the current time the vCPU resumes running. Because the target expiration is incremented by only one period on each timer expiration, this leads to a series of timer expirations occurring rapidly after the vCPU/VM resumes. More critically, when the vCPU first triggers a periodic HV timer expiration after resuming, advancing the expiration by only one period will result in a target expiration in the past. As a result, the delta may be calculated as a negative value. When the delta is converted into an absolute value (tscdeadline is an unsigned u64), the resulting value can overflow what the HV timer is capable of programming. I.e. the large value will exceed the VMX Preemption Timer's maximum bit width of cpu_preemption_timer_multi + 32, and thus cause KVM to switch from the HV timer to the software timer (hrtimers). After switching to the software timer, periodic timer expiration callbacks may be executed consecutively within a single clock interrupt handler, because hrtimers honors KVM's request for an expiration in the past and immediately re-invokes KVM's callback after reprogramming. And because the interrupt handler runs with IRQs disabled, restarting KVM's hrtimer over and over until the target expiration is advanced to "now" can result in a hard lockup. E.g. the following hard lockup was triggered in the host when running a Windows VM (only relevant because it used the APIC timer in periodic mode) after resuming the VM from a long suspend (in the host). NMI watchdog: Watchdog detected hard LOCKUP on cpu 45 ... RIP: 0010:advance_periodic_target_expiration+0x4d/0x80 [kvm] ... RSP: 0018:ff4f88f5d98d8ef0 EFLAGS: 00000046 RAX: fff0103f91be678e RBX: fff0103f91be678e RCX: 00843a7d9e127bcc RDX: 0000000000000002 RSI: 0052ca4003697505 RDI: ff440d5bfbdbd500 RBP: ff440d5956f99200 R08: ff2ff2a42deb6a84 R09: 000000000002a6c0 R10: 0122d794016332b3 R11: 0000000000000000 R12: ff440db1af39cfc0 R13: ff440db1af39cfc0 R14: ffffffffc0d4a560 R15: ff440db1af39d0f8 FS: 00007f04a6ffd700(0000) GS:ff440db1af380000(0000) knlGS:000000e38a3b8000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000000d5651feff8 CR3: 000000684e038002 CR4: 0000000000773ee0 PKRU: 55555554 Call Trace: <IRQ> apic_timer_fn+0x31/0x50 [kvm] __hrtimer_run_queues+0x100/0x280 hrtimer_interrupt+0x100/0x210 ? ttwu_do_wakeup+0x19/0x160 smp_apic_timer_interrupt+0x6a/0x130 apic_timer_interrupt+0xf/0x20 </IRQ> Moreover, if the suspend duration of the virtual machine is not long enough to trigger a hard lockup in this scenario, since commit 98c25ead5eda ("KVM: VMX: Move preemption timer <=> hrtimer dance to common x86"), KVM will continue using the software timer until the guest reprograms the APIC timer in some way. Since the periodic timer does not require frequent APIC timer register programming, the guest may continue to use the software timer in ---truncated---
02 / AFFECTED SOFTWARE
Affected packages
8 explicit affected versions
11 explicit affected versions
4 explicit affected versions
6 explicit affected versions
11 explicit affected versions
53 explicit affected versions
116 explicit affected versions
80 explicit affected versions
167 explicit affected versions
50 explicit affected versions
6 explicit affected versions
12 explicit affected versions
19 explicit affected versions
10 explicit affected versions
7 explicit affected versions
90 explicit affected versions
24 explicit affected versions
75 explicit affected versions
75 explicit affected versions
124 explicit affected versions
91 explicit affected versions
79 explicit affected versions
70 explicit affected versions
10 explicit affected versions
32 explicit affected versions
1 explicit affected versions
1 explicit affected versions
26 explicit affected versions
82 explicit affected versions
7 explicit affected versions
77 explicit affected versions
21 explicit affected versions
12 explicit affected versions
35 explicit affected versions
13 explicit affected versions
85 explicit affected versions
39 explicit affected versions
35 explicit affected versions
42 explicit affected versions
40 explicit affected versions
18 explicit affected versions
35 explicit affected versions
11 explicit affected versions
111 explicit affected versions
118 explicit affected versions
64 explicit affected versions
40 explicit affected versions
120 explicit affected versions
13 explicit affected versions
4 explicit affected versions
23 explicit affected versions
47 explicit affected versions
4 explicit affected versions
13 explicit affected versions
9 explicit affected versions
16 explicit affected versions
10 explicit affected versions
15 explicit affected versions
76 explicit affected versions
1 explicit affected versions
43 explicit affected versions
7 explicit affected versions
12 explicit affected versions
14 explicit affected versions
10 explicit affected versions
12 explicit affected versions
1 explicit affected versions
7 explicit affected versions
11 explicit affected versions
104 explicit affected versions
12 explicit affected versions
105 explicit affected versions
12 explicit affected versions
36 explicit affected versions
36 explicit affected versions
16 explicit affected versions
12 explicit affected versions
25 explicit affected versions
29 explicit affected versions
10 explicit affected versions
37 explicit affected versions
10 explicit affected versions
4 explicit affected versions
13 explicit affected versions
35 explicit affected versions
3 explicit affected versions
10 explicit affected versions
11 explicit affected versions
57 explicit affected versions
26 explicit affected versions
6 explicit affected versions
13 explicit affected versions
29 explicit affected versions
1 explicit affected versions
36 explicit affected versions
29 explicit affected versions
111 explicit affected versions
13 explicit affected versions
12 explicit affected versions
87 explicit affected versions
36 explicit affected versions
3 explicit affected versions
1 explicit affected versions
100 explicit affected versions
82 explicit affected versions
45 explicit affected versions
33 explicit affected versions
23 explicit affected versions
51 explicit affected versions
10 explicit affected versions
15 explicit affected versions
14 explicit affected versions
11 explicit affected versions
5 explicit affected versions
12 explicit affected versions
4 explicit affected versions
7 explicit affected versions
3 explicit affected versions
11 explicit affected versions
138 explicit affected versions
5 explicit affected versions
67 explicit affected versions
132 explicit affected versions
83 explicit affected versions
154 explicit affected versions
10 explicit affected versions
26 explicit affected versions
34 explicit affected versions
1 explicit affected versions
59 explicit affected versions
30 explicit affected versions
42 explicit affected versions
13 explicit affected versions
41 explicit affected versions
139 explicit affected versions
78 explicit affected versions
16 explicit affected versions
1 explicit affected versions
81 explicit affected versions
45 explicit affected versions
116 explicit affected versions
3 explicit affected versions
132 explicit affected versions
93 explicit affected versions
1 explicit affected versions
7 explicit affected versions
2 explicit affected versions
10 explicit affected versions
51 explicit affected versions
11 explicit affected versions
92 explicit affected versions
18 explicit affected versions
1 explicit affected versions
37 explicit affected versions
12 explicit affected versions
66 explicit affected versions
70 explicit affected versions
3 explicit affected versions
27 explicit affected versions
56 explicit affected versions
121 explicit affected versions
8 explicit affected versions
98 explicit affected versions
38 explicit affected versions
8 explicit affected versions
47 explicit affected versions
5 explicit affected versions
8 explicit affected versions
1 explicit affected versions
10 explicit affected versions
7 explicit affected versions
41 explicit affected versions
13 explicit affected versions
110 explicit affected versions
13 explicit affected versions
72 explicit affected versions
7 explicit affected versions
140 explicit affected versions
94 explicit affected versions
10 explicit affected versions
12 explicit affected versions
9 explicit affected versions
9 explicit affected versions
12 explicit affected versions
11 explicit affected versions
30 explicit affected versions
108 explicit affected versions
80 explicit affected versions
56 explicit affected versions
44 explicit affected versions
16 explicit affected versions
3 explicit affected versions
13 explicit affected versions
26 explicit affected versions
45 explicit affected versions
37 explicit affected versions
46 explicit affected versions
14 explicit affected versions
38 explicit affected versions
7 explicit affected versions
34 explicit affected versions
15 explicit affected versions
9 explicit affected versions
83 explicit affected versions
8 explicit affected versions
121 explicit affected versions
4 explicit affected versions
72 explicit affected versions
3 explicit affected versions
1 explicit affected versions
1 explicit affected versions
1 explicit affected versions
81 explicit affected versions
72 explicit affected versions
71 explicit affected versions
43 explicit affected versions
77 explicit affected versions
9 explicit affected versions
119 explicit affected versions
10 explicit affected versions
8 explicit affected versions
40 explicit affected versions
88 explicit affected versions
14 explicit affected versions
4 explicit affected versions
78 explicit affected versions
9 explicit affected versions
11 explicit affected versions
1 explicit affected versions
69 explicit affected versions
123 explicit affected versions
14 explicit affected versions
34 explicit affected versions
71 explicit affected versions
03 / CONNECTIONS
Connected vulnerabilities
04 / EVIDENCE
Source records
In the Linux kernel, the following vulnerability has been resolved: KVM: x86: Fix VM hard lockup after prolonged inactivity with periodic HV timer When advancing the target expiration for the guest's APIC timer in periodic mode, set the expiration to "now" if the target expiration is in the past (similar to what is done in update_target_expiration()). Blindly adding the period to the previous target expiration can result in KVM generating a practically unbounded number of hrtimer IRQs due to programming an expired timer over and over. In extreme scenarios, e.g. if userspace pauses/suspends a VM for an extended duration, this can even cause hard lockups in the host. Currently, the bug only affects Intel CPUs when using the hypervisor timer (HV timer), a.k.a. the VMX preemption timer. Unlike the software timer, a.k.a. hrtimer, which KVM keeps running even on exits to userspace, the HV timer only runs while the guest is active. As a result, if the vCPU does not run for an extended duration, there will be a huge gap between the target expiration and the current time the vCPU resumes running. Because the target expiration is incremented by only one period on each timer expiration, this leads to a series of timer expirations occurring rapidly after the vCPU/VM resumes. More critically, when the vCPU first triggers a periodic HV timer expiration after resuming, advancing the expiration by only one period will result in a target expiration in the past. As a result, the delta may be calculated as a negative value. When the delta is converted into an absolute value (tscdeadline is an unsigned u64), the resulting value can overflow what the HV timer is capable of programming. I.e. the large value will exceed the VMX Preemption Timer's maximum bit width of cpu_preemption_timer_multi + 32, and thus cause KVM to switch from the HV timer to the software timer (hrtimers). After switching to the software timer, periodic timer expiration callbacks may be executed consecutively within a single clock interrupt handler, because hrtimers honors KVM's request for an expiration in the past and immediately re-invokes KVM's callback after reprogramming. And because the interrupt handler runs with IRQs disabled, restarting KVM's hrtimer over and over until the target expiration is advanced to "now" can result in a hard lockup. E.g. the following hard lockup was triggered in the host when running a Windows VM (only relevant because it used the APIC timer in periodic mode) after resuming the VM from a long suspend (in the host). NMI watchdog: Watchdog detected hard LOCKUP on cpu 45 ... RIP: 0010:advance_periodic_target_expiration+0x4d/0x80 [kvm] ... RSP: 0018:ff4f88f5d98d8ef0 EFLAGS: 00000046 RAX: fff0103f91be678e RBX: fff0103f91be678e RCX: 00843a7d9e127bcc RDX: 0000000000000002 RSI: 0052ca4003697505 RDI: ff440d5bfbdbd500 RBP: ff440d5956f99200 R08: ff2ff2a42deb6a84 R09: 000000000002a6c0 R10: 0122d794016332b3 R11: 0000000000000000 R12: ff440db1af39cfc0 R13: ff440db1af39cfc0 R14: ffffffffc0d4a560 R15: ff440db1af39d0f8 FS: 00007f04a6ffd700(0000) GS:ff440db1af380000(0000) knlGS:000000e38a3b8000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000000d5651feff8 CR3: 000000684e038002 CR4: 0000000000773ee0 PKRU: 55555554 Call Trace: <IRQ> apic_timer_fn+0x31/0x50 [kvm] __hrtimer_run_queues+0x100/0x280 hrtimer_interrupt+0x100/0x210 ? ttwu_do_wakeup+0x19/0x160 smp_apic_timer_interrupt+0x6a/0x130 apic_timer_interrupt+0xf/0x20 </IRQ> Moreover, if the suspend duration of the virtual machine is not long enough to trigger a hard lockup in this scenario, since commit 98c25ead5eda ("KVM: VMX: Move preemption timer <=> hrtimer dance to common x86"), KVM will continue using the software timer until the guest reprograms the APIC timer in some way. Since the periodic timer does not require frequent APIC timer register programming, the guest may continue to use the software timer in ---truncated---
05 / REFERENCES
Further evidence
- https://git.kernel.org/stable/c/18ab3fc8e880791aa9f7c000261320fc812b5465
- https://git.kernel.org/stable/c/7b54ccef865e0aa62e4871d4ada2ba4b9dcb8bed
- https://git.kernel.org/stable/c/807dbe8f3862fa7c164155857550ce94b36a11b9
- https://git.kernel.org/stable/c/e23f46f1a971c73dad2fd63e1408696114ddebe2
- https://git.kernel.org/stable/c/e746e51947053a02af2ea964593dc4887108d379
- https://ubuntu.com/security/CVE-2025-71104
- https://ubuntu.com/security/notices/USN-8096-1
- https://ubuntu.com/security/notices/USN-8096-2
- https://ubuntu.com/security/notices/USN-8096-3
- https://ubuntu.com/security/notices/USN-8096-4
- https://ubuntu.com/security/notices/USN-8096-5
- https://ubuntu.com/security/notices/USN-8116-1
- https://ubuntu.com/security/notices/USN-8141-1
- https://ubuntu.com/security/notices/USN-8163-1
- https://ubuntu.com/security/notices/USN-8163-2
- https://ubuntu.com/security/notices/USN-8177-1
- https://ubuntu.com/security/notices/USN-8177-2
- https://ubuntu.com/security/notices/USN-8179-1
- https://ubuntu.com/security/notices/USN-8179-2
- https://ubuntu.com/security/notices/USN-8179-3
- https://ubuntu.com/security/notices/USN-8179-4
- https://ubuntu.com/security/notices/USN-8183-1
- https://ubuntu.com/security/notices/USN-8183-2
- https://ubuntu.com/security/notices/USN-8184-1
- https://ubuntu.com/security/notices/USN-8185-1
- https://ubuntu.com/security/notices/USN-8185-2
- https://ubuntu.com/security/notices/USN-8203-1
- https://ubuntu.com/security/notices/USN-8204-1
- https://ubuntu.com/security/notices/USN-8243-1
- https://ubuntu.com/security/notices/USN-8245-1
- https://ubuntu.com/security/notices/USN-8257-1
- https://ubuntu.com/security/notices/USN-8258-1
- https://ubuntu.com/security/notices/USN-8260-1
- https://ubuntu.com/security/notices/USN-8261-1
- https://ubuntu.com/security/notices/USN-8265-1
- https://ubuntu.com/security/notices/USN-8440-1
- https://www.cve.org/CVERecord?id=CVE-2025-71104