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 B750754673 for ; Fri, 17 May 2024 13:25:10 +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=1715952310; cv=none; b=buwsogu0aUtOMZVJpurTJ4I14jeE77pr1UTXp5YmO+lsycI/FJ6wIQZqxCNf8HueLtId9zt4r2b6N/9lxS1l9RbYPX3IPTMNYpcntMlPPUVztvjrIapE80uzRHtc9ZQnjuVU80f+7iWdcdJWiBDmH5AolrHfPz4C4Urf2ENwUJ0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715952310; c=relaxed/simple; bh=r5ETl1Vrqci5VPLYYT8KNa7aqHNscI4xfspBgy8PX8E=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=D0GcD9lH2A+mcNFifgZQAacOx77gR/oa0z9r7l/ti/Bl6zUJCN0E8fyZz7q4cRnbjPtDNv4KOstuajUaeZnpXZSglFkPJhzEwQ1vm73hhr6zLpNiRYkciIWqokj7A5d8qQKvnoj4OpmULWvV8VQ6meCJG6qdXgcY3LHYuJSu5h8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=uT5/UuHZ; 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="uT5/UuHZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F14B9C2BD10; Fri, 17 May 2024 13:25:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1715952310; bh=r5ETl1Vrqci5VPLYYT8KNa7aqHNscI4xfspBgy8PX8E=; h=From:To:Cc:Subject:Date:Reply-to:From; b=uT5/UuHZmQHCtXpvaAHS5v2ZzGMhEpP7j7KVgfnRXvrTOCS6t0ZKK2RgtAby5dpFH KvOE1bbMq/UgFjKhmWPRgfS4VqtS9j/vza0ADcMxNvDOixG/oqbXmmSfJ8v8xkJ+3l gp+EpfIaOni7gZaFgWMOc5SWLZbZ/QrN8I0eDs+0= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-35803: x86/efistub: Call mixed mode boot services on the firmware's stack Date: Fri, 17 May 2024 15:23:43 +0200 Message-ID: <2024051739-CVE-2024-35803-c81f@gregkh> X-Mailer: git-send-email 2.45.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=3435; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=r5ETl1Vrqci5VPLYYT8KNa7aqHNscI4xfspBgy8PX8E=; b=owGbwMvMwCRo6H6F97bub03G02pJDGnuUdEsr2W2sj4u/iX6ZM/WZ7v/P2zlt12ns3Ke/t5LX j9yFq8+0xHLwiDIxCArpsjyZRvP0f0VhxS9DG1Pw8xhZQIZwsDFKQATqdnDsGD6hg0l+ybN6+6+ FGby8NtaP/8E/dMMc8XuhEivNnuvM9368Jdrt/VzYsRPswMA 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/efistub: Call mixed mode boot services on the firmware's stack Normally, the EFI stub calls into the EFI boot services using the stack that was live when the stub was entered. According to the UEFI spec, this stack needs to be at least 128k in size - this might seem large but all asynchronous processing and event handling in EFI runs from the same stack and so quite a lot of space may be used in practice. In mixed mode, the situation is a bit different: the bootloader calls the 32-bit EFI stub entry point, which calls the decompressor's 32-bit entry point, where the boot stack is set up, using a fixed allocation of 16k. This stack is still in use when the EFI stub is started in 64-bit mode, and so all calls back into the EFI firmware will be using the decompressor's limited boot stack. Due to the placement of the boot stack right after the boot heap, any stack overruns have gone unnoticed. However, commit 5c4feadb0011983b ("x86/decompressor: Move global symbol references to C code") moved the definition of the boot heap into C code, and now the boot stack is placed right at the base of BSS, where any overruns will corrupt the end of the .data section. While it would be possible to work around this by increasing the size of the boot stack, doing so would affect all x86 systems, and mixed mode systems are a tiny (and shrinking) fraction of the x86 installed base. So instead, record the firmware stack pointer value when entering from the 32-bit firmware, and switch to this stack every time a EFI boot service call is made. The Linux kernel CVE team has assigned CVE-2024-35803 to this issue. Affected and fixed versions =========================== Fixed in 6.1.84 with commit 2149f8a56e2e Fixed in 6.6.24 with commit 930775060ca3 Fixed in 6.7.12 with commit fba7ee718758 Fixed in 6.8.3 with commit 725351c03645 Fixed in 6.9 with commit cefcd4fe2e3a 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-35803 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/boot/compressed/efi_mixed.S 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/2149f8a56e2ed345c7a4d022a79f6b8fc53ae926 https://git.kernel.org/stable/c/930775060ca348b8665f60eef14b204172d14f31 https://git.kernel.org/stable/c/fba7ee7187581b5bc222003e73e2592b398bb06d https://git.kernel.org/stable/c/725351c036452b7db5771a7bed783564bc4b99cc https://git.kernel.org/stable/c/cefcd4fe2e3aaf792c14c9e56dab89e3d7a65d02