KVM security fixes land for x86 and other arches, with stable backports and a cgroup kill rewrite
Paolo Bonzini posted a 17-patch KVM series covering TLB races, a hypervisor timer lockup, APIC timer metadata, guest FPU state, and posted interrupts, then queued the same work for 6.12 and 6.18. Separately, Shakeel Butt's cgroup series drops a long-held mutex from kill and freeze.
Linux KVM maintainers this week posted a batch of fixes for vulnerabilities that are mostly on x86 but also touch LoongArch and RISC-V, then immediately queued matching stable backports. The series, sent by Paolo Bonzini with most of the patches from Sean Christopherson and the architecture TLB work from Kyle Zeng, is framed as a security drop rather than routine cleanup. Hosts that run untrusted guests are the audience that matters.
The sharpest host-side failure is in the VMX preemption timer. If a guest sets a large TSC, puts the local APIC timer in periodic mode, and programs a maximal period, KVM can compute a deadline that looks like it is already in the past. The hypervisor timer stays armed, the fast path recomputes the same deadline, and the CPU can bounce in and out of the guest without ever running a guest instruction. On bare metal that tight loop can fail to open a window for host interrupts, and the worst case is a hard lockup of the host. The fix disables the hypervisor timer when converting an expiry to a TSC deadline would wrap.
A second timer bug lets a misbehaving guest overflow a 64-bit value and trigger a divide error in the host. After reset or init the APIC divide count is zero, which KVM treats as a divisor of 2. Repeated init cycles can scale the stored expiration until the math faults. The series resets local APIC timer metadata on reset, init, and when userspace reloads the APIC state, while leaving the TSC deadline MSR tracking alone on that reload path.
Several memory-management fixes close use-after-free and stale-translation windows. On x86, LoongArch, and RISC-V, KVM must flush TLB entries before it drops the MMU lock, including when a walk yields. On x86 the flush is of the whole TLB, not a precise range, and a flush is also required if a child entry is zapped while a huge page is split. When a VM or its process is dying, all guest-to-host page caches are invalidated. Xen event-channel setup pins the VM's address space before borrowing it. Guest FPU updates now require the guest state to be resident in hardware before the XFD register is written, and posted-interrupt delivery checks that the target physical CPU is valid before sending an inter-processor interrupt.
Bonzini posted the same 17-patch set for the 6.12 and 6.18 stable trees within minutes of the mainline series. The stable cover letters describe the same TLB, timer, FPU, and interrupt fixes, so older long-term kernels are expected to pick up the batch rather than wait for a later merge window.
In a separate series the same day, Shakeel Butt posted a third revision that stops cgroup kill and freeze from holding the cgroup mutex while they walk every task in a subtree. At Meta, writers including systemd, userspace out-of-memory killers, a build system, and a container agent were reported blocked in cgroup kill for more than 120 seconds, and a sampler saw waits of up to 61 minutes, often behind directory create or remove that itself was stuck on filesystem locking or memory reclaim. Kill is how service managers and container runtimes stop a workload, frequently when the machine is already under pressure.
The rewrite keeps the guarantee that every task in the subtree when the kill starts receives a fatal signal, including tasks that fork or move during the walk, without making kill wait on unrelated cgroup operations. Early patches, several marked for stable, fix bugs found while auditing those paths: a failed migration can hide a task from a process-list reader, a child forked during a kill can survive, killing a cgroup under a threaded parent can hit processes outside it, and freezer state can report a subtree as frozen while part of it is still running.