In the Linux kernel, the following vulnerability has been resolved:
KVM: LAPIC: Also cancel preemption timer during SET_LAPIC
The below warning is splatting during guest reboot.
------------[ cut here ]------------ WARNING: CPU: 0 PID: 1931 at arch/x86/kvm/x86.c:10322 kvmarchvcpuioctlrun+0x874/0x880 [kvm] CPU: 0 PID: 1931 Comm: qemu-system-x86 Tainted: G I 5.17.0-rc1+ #5 RIP: 0010:kvmarchvcpuioctlrun+0x874/0x880 [kvm] Call Trace: <TASK> kvmvcpuioctl+0x279/0x710 [kvm] _x64sysioctl+0x83/0xb0 dosyscall64+0x3b/0xc0 entrySYSCALL64after_hwframe+0x44/0xae RIP: 0033:0x7fd39797350b
This can be triggered by not exposing tsc-deadline mode and doing a reboot in the guest. The lapicshutdown() function which is called in sysreboot path will not disarm the flying timer, it just masks LVTT. lapicshutdown() clears APIC state w/ LVTMASKED and timer-mode bit is 0, this can trigger timer-mode switch between tsc-deadline and oneshot/periodic, which can result in preemption timer be cancelled in apicupdatelvtt(). However, We can't depend on this when not exposing tsc-deadline mode and oneshot/periodic modes emulated by preemption timer. Qemu will synchronise states around reset, let's cancel preemption timer under KVMSETLAPIC.
[
{
"id": "CVE-2022-48765-0dfbc2e4",
"target": {
"function": "kvm_apic_set_state",
"file": "arch/x86/kvm/lapic.c"
},
"signature_version": "v1",
"digest": {
"length": 1211.0,
"function_hash": "22754427546640269029393079030097653643"
},
"deprecated": false,
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ce55f63f6cea4cab8ae9212f73285648a5baa30d"
},
{
"id": "CVE-2022-48765-2f8d0f56",
"target": {
"file": "arch/x86/kvm/lapic.c"
},
"signature_version": "v1",
"digest": {
"line_hashes": [
"313999489440057295650160090711256730880",
"198407853460327815619635602545698630517",
"170969419738355727159588652710328902149",
"323191083886930435668463633031446624825"
],
"threshold": 0.9
},
"deprecated": false,
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@35fe7cfbab2e81f1afb23fc4212210b1de6d9633"
},
{
"id": "CVE-2022-48765-397cfdda",
"target": {
"file": "arch/x86/kvm/lapic.c"
},
"signature_version": "v1",
"digest": {
"line_hashes": [
"313999489440057295650160090711256730880",
"198407853460327815619635602545698630517",
"170969419738355727159588652710328902149",
"323191083886930435668463633031446624825"
],
"threshold": 0.9
},
"deprecated": false,
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ce55f63f6cea4cab8ae9212f73285648a5baa30d"
},
{
"id": "CVE-2022-48765-4259d604",
"target": {
"function": "kvm_apic_set_state",
"file": "arch/x86/kvm/lapic.c"
},
"signature_version": "v1",
"digest": {
"length": 1211.0,
"function_hash": "22754427546640269029393079030097653643"
},
"deprecated": false,
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@35fe7cfbab2e81f1afb23fc4212210b1de6d9633"
},
{
"id": "CVE-2022-48765-ad4ebc18",
"target": {
"function": "kvm_apic_set_state",
"file": "arch/x86/kvm/lapic.c"
},
"signature_version": "v1",
"digest": {
"length": 1211.0,
"function_hash": "22754427546640269029393079030097653643"
},
"deprecated": false,
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@54b3439c8e70e0bcfea59aeef9dd98908cbbf655"
},
{
"id": "CVE-2022-48765-e34b0946",
"target": {
"file": "arch/x86/kvm/lapic.c"
},
"signature_version": "v1",
"digest": {
"line_hashes": [
"313999489440057295650160090711256730880",
"198407853460327815619635602545698630517",
"170969419738355727159588652710328902149",
"323191083886930435668463633031446624825"
],
"threshold": 0.9
},
"deprecated": false,
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@54b3439c8e70e0bcfea59aeef9dd98908cbbf655"
}
]