x86/acpi: Prevent out of bound access caused by broken ACPI tables
authorSeunghun Han <kkamagui@gmail.com>
Tue, 18 Jul 2017 11:03:51 +0000 (20:03 +0900)
committerBen Hutchings <ben@decadent.org.uk>
Sat, 11 Nov 2017 13:34:24 +0000 (13:34 +0000)
commit96301209473afd3f2f274b91cb7082d161b9be65
treeae4b821b9902de4387636e6d710709139d407371
parent57f45c30eee35f02adee5d96442e38d6c3884263
x86/acpi: Prevent out of bound access caused by broken ACPI tables

commit dad5ab0db8deac535d03e3fe3d8f2892173fa6a4 upstream.

The bus_irq argument of mp_override_legacy_irq() is used as the index into
the isa_irq_to_gsi[] array. The bus_irq argument originates from
ACPI_MADT_TYPE_IO_APIC and ACPI_MADT_TYPE_INTERRUPT items in the ACPI
tables, but is nowhere sanity checked.

That allows broken or malicious ACPI tables to overwrite memory, which
might cause malfunction, panic or arbitrary code execution.

Add a sanity check and emit a warning when that triggers.

[ tglx: Added warning and rewrote changelog ]

Signed-off-by: Seunghun Han <kkamagui@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: security@kernel.org
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
arch/x86/kernel/acpi/boot.c