From df5803ed69a9d84f30836d1b485fd207c2bf3c94 Mon Sep 17 00:00:00 2001 From: Mark Date: Tue, 17 Sep 2019 15:50:14 +0300 Subject: [PATCH] [amd64] Fix acpi signature checking --- src/arch/amd64/acpi/tables.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/arch/amd64/acpi/tables.c b/src/arch/amd64/acpi/tables.c index 3c8234f..41c5226 100644 --- a/src/arch/amd64/acpi/tables.c +++ b/src/arch/amd64/acpi/tables.c @@ -52,6 +52,11 @@ static int acpi_rsdp_read(const struct acpi_rsdp *rsdp) { for (size_t j = 0; j < ACPI_TABLE_TYPE_COUNT; ++j) { if (!strncmp(header->signature, acpi_table_type_name[j], 4)) { kdebug("%u: %s @ %p\n", i, acpi_table_type_name[j], header); + + if (acpi_checksum(header, header->length)) { + panic("RSDT contains invalid table: %s\n", acpi_table_type_name[j]); + } + acpi_tables[j] = (uintptr_t) header; continue; } @@ -121,7 +126,6 @@ int acpi_tables_init(void) { return -1; } } - // TODO: FADT does not validate on qemu, neither have I tested ACPI > 1.0 // Extract HPET if (acpi_tables[ACPI_HPET] != MM_NADDR) {