From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3478A1AB37B for ; Thu, 20 Jun 2024 11:18:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718882311; cv=none; b=ioxbEsgYQ9mOtMvz0BlCHYAP6VHLIo2Vxk3c1gCc9AGXmUvb3tFNds6cTOfqqhN+WgKGhthNB+m9UI5GdRu9Yb6i2OpKJJSNqlDl+f0UZPyVmgriwP0Qhi/QluwqfaaYjZKsM2i/BVuvPC9ywplmOUPvDFRep1+ZVtTEKi09YmM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718882311; c=relaxed/simple; bh=1WDvIMUn9lJaHe5R+JXHVcHWBSiKhGOaWTjG9pqO9eo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=TIGvMvXvOawcuA6IHYUCVOpNIb5oepO02v5NDlXZUPs3oJsPcP24OEzL+njvoXgQWU79rBuaawdQxpdOXSBLoaSZR/hO3HLQItBFpE1ZN3xX0eZDwqbdrA7vSxRrM3RtnERZVLbNmYEisgf3l4H9bpxyo4KCEpv/t1YGpBIcYuA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=OCxTLmWi; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="OCxTLmWi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 980FAC2BD10; Thu, 20 Jun 2024 11:18:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1718882311; bh=1WDvIMUn9lJaHe5R+JXHVcHWBSiKhGOaWTjG9pqO9eo=; h=From:To:Cc:Subject:Date:Reply-to:From; b=OCxTLmWiLLVXQ7Cg+maQC8m4ZYYNvwTYx8bV+79ALSGetc1WRkAaeU3YTF3rON88H KyuFSMXo7fcYQGzLXvKY3DH++g+YdjHt/YG+IAM82sW9E+V90m2reROudnKbQNQpfe 4iY0dh65TTj+ozSt6zXf+qzvL6y/snC0EqHvX8Pc= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-48765: KVM: LAPIC: Also cancel preemption timer during SET_LAPIC Date: Thu, 20 Jun 2024 13:16:45 +0200 Message-ID: <2024062009-CVE-2022-48765-ddb8@gregkh> X-Mailer: git-send-email 2.45.2 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=2850; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=1WDvIMUn9lJaHe5R+JXHVcHWBSiKhGOaWTjG9pqO9eo=; b=kA0DAAIRMUfUDdst+ykByyZiAGZ0D3qhK6pvMEhkzvZQTkeAmBf5vxhZR29wQl8QZRYMFzGXc 4hdBAARAgAdFiEE9LYMxb94wiFKMT3LMUfUDdst+ykFAmZ0D3oACgkQMUfUDdst+yn9+QCgyR2u kkoGWRWt6rq0GHZuAXzXU6UAoICxgGW/jfwuCcXk85gjLwbvzdj2 X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit Description =========== 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 kvm_arch_vcpu_ioctl_run+0x874/0x880 [kvm] CPU: 0 PID: 1931 Comm: qemu-system-x86 Tainted: G I 5.17.0-rc1+ #5 RIP: 0010:kvm_arch_vcpu_ioctl_run+0x874/0x880 [kvm] Call Trace: kvm_vcpu_ioctl+0x279/0x710 [kvm] __x64_sys_ioctl+0x83/0xb0 do_syscall_64+0x3b/0xc0 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7fd39797350b This can be triggered by not exposing tsc-deadline mode and doing a reboot in the guest. The lapic_shutdown() function which is called in sys_reboot path will not disarm the flying timer, it just masks LVTT. lapic_shutdown() clears APIC state w/ LVT_MASKED 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 apic_update_lvtt(). 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 KVM_SET_LAPIC. The Linux kernel CVE team has assigned CVE-2022-48765 to this issue. Affected and fixed versions =========================== Fixed in 5.15.19 with commit 54b3439c8e70 Fixed in 5.16.5 with commit ce55f63f6cea Fixed in 5.17 with commit 35fe7cfbab2e Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2022-48765 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: arch/x86/kvm/lapic.c Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/54b3439c8e70e0bcfea59aeef9dd98908cbbf655 https://git.kernel.org/stable/c/ce55f63f6cea4cab8ae9212f73285648a5baa30d https://git.kernel.org/stable/c/35fe7cfbab2e81f1afb23fc4212210b1de6d9633