5 Star 0 Fork 16

OpenCloudOS Stream/grub2

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0280-kern-acpi-Fix-out-of-bounds-access-in-grub_acpi_xsdt.patch 1.56 KB
一键复制 编辑 原始数据 按行查看 历史
nilusyi 提交于 2024-12-26 19:44 . backport upstream commits
From 2c43798717ee5af0b666fc49b7b8c1d992563f06 Mon Sep 17 00:00:00 2001
From: nilusyi <nilusyi@tencent.com>
Date: Thu, 26 Dec 2024 19:24:32 +0800
Subject: [PATCH 4/4] kern/acpi: Fix out of bounds access in
grub_acpi_xsdt_find_table()
The calculation of the size of the table was incorrect (copy/pasta from
grub_acpi_rsdt_find_table() I assume...). The entries are 64-bit long.
This causes us to access beyond the end of the table which is causing
crashes during boot on some systems. Typically this is causing a crash
on VMWare when using UEFI and enabling serial autodetection, as
grub_acpi_find_table (GRUB_ACPI_SPCR_SIGNATURE);
will goes past the end of the table (the SPCR table doesn't exits).
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Reviewed-by: Vladimir Serbinenko <phcoder@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Reviewed-by: Ross Philipson <ross.philipson@oracle.com>
Tested-by: Renata Ravanelli <rravanel@redhat.com>
---
grub-core/kern/acpi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/grub-core/kern/acpi.c b/grub-core/kern/acpi.c
index 48ded4e2e..8ff0835d5 100644
--- a/grub-core/kern/acpi.c
+++ b/grub-core/kern/acpi.c
@@ -75,7 +75,7 @@ grub_acpi_xsdt_find_table (struct grub_acpi_table_header *xsdt, const char *sig)
return 0;
ptr = (grub_unaligned_uint64_t *) (xsdt + 1);
- s = (xsdt->length - sizeof (*xsdt)) / sizeof (grub_uint32_t);
+ s = (xsdt->length - sizeof (*xsdt)) / sizeof (grub_uint64_t);
for (; s; s--, ptr++)
{
struct grub_acpi_table_header *tbl;
--
2.41.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/opencloudos-stream/grub2.git
git@gitee.com:opencloudos-stream/grub2.git
opencloudos-stream
grub2
grub2
master

搜索帮助