On 10/15/24 10:20 PM, Benjamin Herrenschmidt wrote:
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.

Yup that is correct for XSDT entries, the are 64b each.

Reviewed-by: Ross Philipson <ross.philip...@oracle.com>


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 <b...@kernel.crashing.org>
---
  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;


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://urldefense.com/v3/__https://lists.gnu.org/mailman/listinfo/grub-devel__;!!ACWV5N9M2RV99hQ!LZzJNevc29nuiPlTkhDXJRkXuWKLUkb0jxeBN_xft2rReT26AZmn6hIklTw9WDYSLkPDPGGJ1DXZ-RVYDd-Y0e8$


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to