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 C20D51A5BB9 for ; Wed, 26 Feb 2025 01:58:15 +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=1740535095; cv=none; b=h/OH3MLdB1+ovQAG6O3k7p18FX0l40oE4X0PzsAdkS7mDoRcLDGQQrXaKCUG7Ka/Wi8QHXUylUxBflq3xuTpv+P6yhYyQwU/lwCFHwup/j9by9nk0Kp9hS8gbYX2Jh7OF8Zm/7CBWoFA8sJTx6xLz6TT/Vd/zMC1co2aqULFaYI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740535095; c=relaxed/simple; bh=ibvk95xRoc/Z6V+CV6luPJWtH/1j+bncHWNXydzI9iM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=hsVj+MiyuSsohYkW5b3c6gAFrZa0SvzeEjvBRp0AJTVzgj8WjWxoGXM0jk8WmS+kQe0TpzqASF2a+WRFUA/wdf53UIKKT7bEQBveNlwmDLzTBZbDTHXExQwCQd9PA62Klup8/chbk4I3Nz9I84GqLjkJZG5J5FKAiOPxhAegu2w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=iziiyEMH; 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="iziiyEMH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 965D0C4CEE8; Wed, 26 Feb 2025 01:58:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1740535095; bh=ibvk95xRoc/Z6V+CV6luPJWtH/1j+bncHWNXydzI9iM=; h=From:To:Cc:Subject:Date:Reply-to:From; b=iziiyEMH0myKzgCNV12Km2Bysi8Gjtr5SJNZvIXCOS+6G/Z/AbpKtXP/EnHc0zqed 4+2+HdZ9jL5dtLc9YMlHGxxZfYq/azShE/rHYG2yKUJh3PieF5CPfYYZsF4jvHu0WD 6GwlkCBH3/8NvWZJKQLCLPkx3pqMweeL7Co8eWKY= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-49101: xen: delay xen_hvm_init_time_ops() if kdump is boot on vcpu>=32 Date: Wed, 26 Feb 2025 02:55:06 +0100 Message-ID: <2025022600-CVE-2022-49101-e5e3@gregkh> X-Mailer: git-send-email 2.48.1 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=3840; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=ibvk95xRoc/Z6V+CV6luPJWtH/1j+bncHWNXydzI9iM=; b=owGbwMvMwCRo6H6F97bub03G02pJDOn7Siw+Cni3vxV2/tAb/vxiIvNbXbunMpZdXxLeN/z/4 LP6w4OrHbEsDIJMDLJiiixftvEc3V9xSNHL0PY0zBxWJpAhDFycAjCRrdUM88u7XvuyLD0p5Gya vdfWjy391+9zqxnmqSzU9d078f2cxUVhvn4WXpxBv7rXAwA= 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: xen: delay xen_hvm_init_time_ops() if kdump is boot on vcpu>=32 The sched_clock() can be used very early since commit 857baa87b642 ("sched/clock: Enable sched clock early"). In addition, with commit 38669ba205d1 ("x86/xen/time: Output xen sched_clock time from 0"), kdump kernel in Xen HVM guest may panic at very early stage when accessing &__this_cpu_read(xen_vcpu)->time as in below: setup_arch() -> init_hypervisor_platform() -> x86_init.hyper.init_platform = xen_hvm_guest_init() -> xen_hvm_init_time_ops() -> xen_clocksource_read() -> src = &__this_cpu_read(xen_vcpu)->time; This is because Xen HVM supports at most MAX_VIRT_CPUS=32 'vcpu_info' embedded inside 'shared_info' during early stage until xen_vcpu_setup() is used to allocate/relocate 'vcpu_info' for boot cpu at arbitrary address. However, when Xen HVM guest panic on vcpu >= 32, since xen_vcpu_info_reset(0) would set per_cpu(xen_vcpu, cpu) = NULL when vcpu >= 32, xen_clocksource_read() on vcpu >= 32 would panic. This patch calls xen_hvm_init_time_ops() again later in xen_hvm_smp_prepare_boot_cpu() after the 'vcpu_info' for boot vcpu is registered when the boot vcpu is >= 32. This issue can be reproduced on purpose via below command at the guest side when kdump/kexec is enabled: "taskset -c 33 echo c > /proc/sysrq-trigger" The bugfix for PVM is not implemented due to the lack of testing environment. [boris: xen_hvm_init_time_ops() returns on errors instead of jumping to end] The Linux kernel CVE team has assigned CVE-2022-49101 to this issue. Affected and fixed versions =========================== Fixed in 4.19.238 with commit 0848767dee78c00c5646eef9b3201ee14ce68563 Fixed in 5.4.189 with commit 8a7462b5211cd5b74b8815034d038e28cbd96d52 Fixed in 5.10.111 with commit a2a0e04f6478e8c1038db64717f3fafd55de1420 Fixed in 5.15.34 with commit 5c0750cad73350e1c504eb91a94093a79f6f6296 Fixed in 5.16.20 with commit be63f365f454e39d09c41bbd21ea72b5244160b5 Fixed in 5.17.3 with commit b6f6b353d6c765b83c9e5e518a44ca1ae40fe227 Fixed in 5.18 with commit eed05744322da07dd7e419432dcedf3c2e017179 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-49101 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/xen/smp_hvm.c arch/x86/xen/time.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/0848767dee78c00c5646eef9b3201ee14ce68563 https://git.kernel.org/stable/c/8a7462b5211cd5b74b8815034d038e28cbd96d52 https://git.kernel.org/stable/c/a2a0e04f6478e8c1038db64717f3fafd55de1420 https://git.kernel.org/stable/c/5c0750cad73350e1c504eb91a94093a79f6f6296 https://git.kernel.org/stable/c/be63f365f454e39d09c41bbd21ea72b5244160b5 https://git.kernel.org/stable/c/b6f6b353d6c765b83c9e5e518a44ca1ae40fe227 https://git.kernel.org/stable/c/eed05744322da07dd7e419432dcedf3c2e017179