linux-yocto/include/acpi
Ahmed Salem c05aba32a9 ACPICA: Avoid sequence overread in call to strncmp()
[ Upstream commit 64b9dfd077 ]

ACPICA commit 8b83a8d88dfec59ea147fad35fc6deea8859c58c

ap_get_table_length() checks if tables are valid by
calling ap_is_valid_header(). The latter then calls
ACPI_VALIDATE_RSDP_SIG(Table->Signature).

ap_is_valid_header() accepts struct acpi_table_header as an argument, so
the signature size is always fixed to 4 bytes.

The problem is when the string comparison is between ACPI-defined table
signature and ACPI_SIG_RSDP. Common ACPI table header specifies the
Signature field to be 4 bytes long[1], with the exception of the RSDP
structure whose signature is 8 bytes long "RSD PTR " (including the
trailing blank character)[2]. Calling strncmp(sig, rsdp_sig, 8) would
then result in a sequence overread[3] as sig would be smaller (4 bytes)
than the specified bound (8 bytes).

As a workaround, pass the bound conditionally based on the size of the
signature being passed.

Link: https://uefi.org/specs/ACPI/6.5_A/05_ACPI_Software_Programming_Model.html#system-description-table-header [1]
Link: https://uefi.org/specs/ACPI/6.5_A/05_ACPI_Software_Programming_Model.html#root-system-description-pointer-rsdp-structure [2]
Link: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wstringop-overread [3]
Link: https://github.com/acpica/acpica/commit/8b83a8d8
Signed-off-by: Ahmed Salem <x0rw3ll@gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://patch.msgid.link/2248233.Mh6RI2rZIc@rjwysocki.net
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-06-27 11:11:26 +01:00
..
platform ACPICA: haiku: Fix invalid value used for semaphores 2024-08-29 17:26:51 +02:00
acbuffer.h
acconfig.h ACPICA: Detect FACS in reduced hardware build 2024-08-29 14:40:28 +02:00
acexcep.h
acnames.h ACPICA: Detect GED device and keep track of _EVT 2023-07-10 18:33:47 +02:00
acoutput.h ACPICA: Implement ACPI_WARNING_ONCE and ACPI_ERROR_ONCE 2024-08-29 17:51:24 +02:00
acpi_bus.h Merge branches 'acpi-video', 'acpi-resource', 'acpi-pad' and 'acpi-misc' 2024-09-11 22:05:16 +02:00
acpi_drivers.h ACPI: platform: Move SMB0001 HID to the header and reuse 2023-07-04 19:28:20 +02:00
acpi_io.h
acpi_lpat.h
acpi_numa.h
acpi.h
acpiosxf.h
acpixf.h LoongArch: Fix warnings during S3 suspend 2025-02-08 09:57:59 +01:00
acrestyp.h
actbl.h ACPI: CPPC: Add definition for undefined FADT preferred PM profile value 2023-06-21 18:44:56 +02:00
actbl1.h ACPICA: HMAT: Add extended linear address mode to MSCIS 2024-08-29 19:04:22 +02:00
actbl2.h ACPICA: MPAM: Correct the typo in struct acpi_mpam_msc_node member 2024-08-29 17:48:53 +02:00
actbl3.h ACPICA: SPCR: Update the SPCR table to version 4 2024-08-29 17:34:36 +02:00
actypes.h ACPICA: Avoid sequence overread in call to strncmp() 2025-06-27 11:11:26 +01:00
acuuid.h
apei.h
battery.h ACPI: battery: add devm_battery_hook_register() 2024-07-01 21:22:18 +08:00
button.h
cppc_acpi.h ACPI: CPPC: Make rmw_lock a raw_spin_lock 2024-10-29 12:56:19 +01:00
ghes.h ACPI: APEI: Fix AER info corruption when error status data has multiple sections 2023-09-21 20:44:23 +02:00
hed.h
nfit.h
nhlt.h ACPI: NHLT: Streamline struct naming 2024-03-27 16:36:45 +01:00
pcc.h mailbox: pcc: Check before sending MCTP PCC response ACK 2024-12-14 20:04:03 +01:00
proc_cap_intel.h ACPI: processor: Introduce acpi_processor_osc() 2023-07-14 17:59:40 +02:00
processor.h ACPI: processor: Move arch_init_invariance_cppc() call later 2024-11-06 21:31:36 +01:00
reboot.h
video.h ACPI: video: Add Dell UART backlight controller detection 2024-08-19 15:58:35 +02:00