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 DA5B91DE897 for ; Mon, 21 Oct 2024 12:19:28 +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=1729513170; cv=none; b=glmiZeRH8jpHWEY/I7GfQh4NBQkV+p9AHlP0k6wvolI619JUsOhD2p5tZwzmxlviDHPzp7QWhXXx7flS5BeEufQN4jjf5JZM6JlYjrtjRKHlzNMNtYmF0Ko/0x0fAfAE3Kp/Eo94hfsbrNibbp3jipaUNwweoCykHCef+43TVcU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729513170; c=relaxed/simple; bh=RmlEOX28oBivTavT92GDbTJioO7hkZr+W77m4MU+8Qs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=DTTCCsD+dFY0C81CLcxuNHbSVeANsQW8YX5DVkx993qZzOYjq5v6AR42lQHfuRJ2ML8x5935xKA67rzr0qaaPzRSNfDXJ53spZJie95iinDKriU7ougRbfTpvo1DP3zcfbBIFAYD5DUqrCzNKLqbAUtxyd54T1KXpW0wsvUW4Wg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=A5rHBM9/; 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="A5rHBM9/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08B8CC4CEC3; Mon, 21 Oct 2024 12:19:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1729513168; bh=RmlEOX28oBivTavT92GDbTJioO7hkZr+W77m4MU+8Qs=; h=From:To:Cc:Subject:Date:Reply-to:From; b=A5rHBM9/oZflfKJCoK0AaOUZf1/2PM5lAltYPgi/gBM9d145uPWgChwqjIhX/2QDp 52KJYqiMlgHB6lg/Q+y2nwWIvdmTdOAXiV2UyQ1SJBStk1gho0uHQRNXog+FX6n3vV J2SgtP5ydlVeBWl2ZzmNCCgXd0O9bQ7ad1xJKb+A= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-49856: x86/sgx: Fix deadlock in SGX NUMA node search Date: Mon, 21 Oct 2024 14:18:58 +0200 Message-ID: <2024102154-CVE-2024-49856-f5f7@gregkh> X-Mailer: git-send-email 2.47.0 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=3122; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=RmlEOX28oBivTavT92GDbTJioO7hkZr+W77m4MU+8Qs=; b=owGbwMvMwCRo6H6F97bub03G02pJDOlibutmHPnpt1xR/vt3hfQpoi/OnspI3KKwserFjv2qz oLTbxtkdMSyMAgyMciKKbJ82cZzdH/FIUUvQ9vTMHNYmUCGMHBxCsBEdm5nWNBan+tfLyZwxyFm bn8rf0ag/3mNuwwLDrWy8ybYKy/68/xi3B1XtcVO87J6AA== 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: x86/sgx: Fix deadlock in SGX NUMA node search When the current node doesn't have an EPC section configured by firmware and all other EPC sections are used up, CPU can get stuck inside the while loop that looks for an available EPC page from remote nodes indefinitely, leading to a soft lockup. Note how nid_of_current will never be equal to nid in that while loop because nid_of_current is not set in sgx_numa_mask. Also worth mentioning is that it's perfectly fine for the firmware not to setup an EPC section on a node. While setting up an EPC section on each node can enhance performance, it is not a requirement for functionality. Rework the loop to start and end on *a* node that has SGX memory. This avoids the deadlock looking for the current SGX-lacking node to show up in the loop when it never will. The Linux kernel CVE team has assigned CVE-2024-49856 to this issue. Affected and fixed versions =========================== Issue introduced in 5.13 with commit 901ddbb9ecf5 and fixed in 5.15.168 with commit 40fb64257dab Issue introduced in 5.13 with commit 901ddbb9ecf5 and fixed in 6.1.113 with commit 20c96d0aaabf Issue introduced in 5.13 with commit 901ddbb9ecf5 and fixed in 6.6.54 with commit fb2d057539ed Issue introduced in 5.13 with commit 901ddbb9ecf5 and fixed in 6.10.13 with commit 0f89fb4042c0 Issue introduced in 5.13 with commit 901ddbb9ecf5 and fixed in 6.11.2 with commit 8132510c9158 Issue introduced in 5.13 with commit 901ddbb9ecf5 and fixed in 6.12-rc1 with commit 9c9368440104 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-2024-49856 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/kernel/cpu/sgx/main.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/40fb64257dab507d86b5f1f2a62f3669ef0c91a8 https://git.kernel.org/stable/c/20c96d0aaabfe361fc2a11c173968dc67feadbbf https://git.kernel.org/stable/c/fb2d057539eda67ec7cfc369bf587e6518a9b99d https://git.kernel.org/stable/c/0f89fb4042c08fd143bfc28af08bf6c8a0197eea https://git.kernel.org/stable/c/8132510c915815e6b537ab937d94ed66893bc7b8 https://git.kernel.org/stable/c/9c936844010466535bd46ea4ce4656ef17653644