Running 'iasl -T all' would segfault

Dumping all the templates worked fine until the PHAT dump, which
caused the segfault; removing extraneous assignments from big-endian
patch for the table fixes the problem.

Resolves: rhbz#1967794

Signed-off-by: Al Stone <ahs3@redhat.com>
This commit is contained in:
Al Stone 2021-07-27 16:47:53 -06:00 committed by Dean Nelson
parent 976008e29e
commit 09c0b9450a
2 changed files with 12 additions and 9 deletions

View File

@ -13,14 +13,15 @@ Index: acpica-unix2-20210604/source/common/dmtbdump2.c
=================================================================== ===================================================================
--- acpica-unix2-20210604.orig/source/common/dmtbdump2.c --- acpica-unix2-20210604.orig/source/common/dmtbdump2.c
+++ acpica-unix2-20210604/source/common/dmtbdump2.c +++ acpica-unix2-20210604/source/common/dmtbdump2.c
@@ -1573,39 +1573,43 @@ AcpiDmDumpPhat ( @@ -1573,39 +1573,41 @@ AcpiDmDumpPhat (
ACPI_PHAT_HEADER *Subtable; ACPI_PHAT_HEADER *Subtable;
ACPI_PHAT_VERSION_DATA *VersionData; ACPI_PHAT_VERSION_DATA *VersionData;
UINT32 RecordCount; UINT32 RecordCount;
- UINT32 Length = Table->Length; - UINT32 Length = Table->Length;
+ UINT32 TableLength = AcpiUtReadUint32 (&Table->Length); + UINT32 TableLength = AcpiUtReadUint32 (&Table->Length);
UINT32 Offset = sizeof (ACPI_TABLE_PHAT); UINT32 Offset = sizeof (ACPI_TABLE_PHAT);
UINT32 SubtableLength; - UINT32 SubtableLength;
+ UINT16 SubtableLength;
UINT32 PathLength; UINT32 PathLength;
UINT32 VendorLength; UINT32 VendorLength;
+ UINT16 SubtableType; + UINT16 SubtableType;
@ -34,9 +35,7 @@ Index: acpica-unix2-20210604/source/common/dmtbdump2.c
/* Common subtable header */ /* Common subtable header */
+ SubtableType = AcpiUtReadUint16 (&Subtable->Type); + SubtableType = AcpiUtReadUint16 (&Subtable->Type);
+ Subtable->Type = SubtableType;
+ SubtableLength = AcpiUtReadUint16 (&Subtable->Length); + SubtableLength = AcpiUtReadUint16 (&Subtable->Length);
+ Subtable->Length = SubtableLength;
+ +
AcpiOsPrintf ("\n"); AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Length, 0, Subtable, - Status = AcpiDmDumpTable (Length, 0, Subtable,
@ -63,7 +62,7 @@ Index: acpica-unix2-20210604/source/common/dmtbdump2.c
break; break;
default: default:
@@ -1616,22 +1620,22 @@ AcpiDmDumpPhat ( @@ -1616,22 +1618,22 @@ AcpiDmDumpPhat (
return; return;
} }
@ -90,7 +89,7 @@ Index: acpica-unix2-20210604/source/common/dmtbdump2.c
ACPI_ADD_PTR (ACPI_PHAT_HEADER, Subtable, sizeof (ACPI_PHAT_VERSION_DATA)), ACPI_ADD_PTR (ACPI_PHAT_HEADER, Subtable, sizeof (ACPI_PHAT_VERSION_DATA)),
sizeof (ACPI_PHAT_VERSION_ELEMENT), AcpiDmTableInfoPhat0a); sizeof (ACPI_PHAT_VERSION_ELEMENT), AcpiDmTableInfoPhat0a);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
@@ -1649,7 +1653,7 @@ AcpiDmDumpPhat ( @@ -1649,7 +1651,7 @@ AcpiDmDumpPhat (
/* account for the null terminator */ /* account for the null terminator */
PathLength = strlen (ACPI_ADD_PTR (char, Subtable, sizeof (ACPI_PHAT_HEALTH_DATA))) + 1; PathLength = strlen (ACPI_ADD_PTR (char, Subtable, sizeof (ACPI_PHAT_HEALTH_DATA))) + 1;
@ -99,7 +98,7 @@ Index: acpica-unix2-20210604/source/common/dmtbdump2.c
ACPI_ADD_PTR (ACPI_PHAT_HEADER, Subtable, sizeof (ACPI_PHAT_HEALTH_DATA)), ACPI_ADD_PTR (ACPI_PHAT_HEADER, Subtable, sizeof (ACPI_PHAT_HEALTH_DATA)),
PathLength, AcpiDmTableInfoPhat1a); PathLength, AcpiDmTableInfoPhat1a);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
@@ -1660,8 +1664,8 @@ AcpiDmDumpPhat ( @@ -1660,8 +1662,8 @@ AcpiDmDumpPhat (
/* Get vendor data - data length is the remaining subtable length */ /* Get vendor data - data length is the remaining subtable length */
VendorLength = VendorLength =
@ -110,7 +109,7 @@ Index: acpica-unix2-20210604/source/common/dmtbdump2.c
ACPI_ADD_PTR (ACPI_PHAT_HEADER, Subtable, sizeof (ACPI_PHAT_HEALTH_DATA) + PathLength), ACPI_ADD_PTR (ACPI_PHAT_HEADER, Subtable, sizeof (ACPI_PHAT_HEALTH_DATA) + PathLength),
VendorLength, AcpiDmTableInfoPhat1b); VendorLength, AcpiDmTableInfoPhat1b);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
@@ -1673,15 +1677,15 @@ AcpiDmDumpPhat ( @@ -1673,15 +1675,15 @@ AcpiDmDumpPhat (
default: default:
AcpiOsPrintf ("\n**** Unknown PHAT subtable type 0x%X\n\n", AcpiOsPrintf ("\n**** Unknown PHAT subtable type 0x%X\n\n",

View File

@ -1,6 +1,6 @@
Name: acpica-tools Name: acpica-tools
Version: 20210604 Version: 20210604
Release: 1%{?dist} Release: 2%{?dist}
Summary: ACPICA tools for the development and debug of ACPI tables Summary: ACPICA tools for the development and debug of ACPI tables
License: GPLv2 License: GPLv2
@ -254,6 +254,10 @@ fi
%changelog %changelog
* Tue Jul 27 2021 Al Stone <ahs3@redhat.com> - 20210604-2
- Running 'iasl -T all' would segfault when dumping the PHAT template;
fixed AcpiDmDumpPhat() by removing unnecessary assignments from patch
* Fri Jul 23 2021 Dean Nelson <dnelson@redhat.com> - 20210604-1 * Fri Jul 23 2021 Dean Nelson <dnelson@redhat.com> - 20210604-1
- Update to 20210604 source tree. - Update to 20210604 source tree.
- Bring the big-endian patches up-to-date with what has been submitted - Bring the big-endian patches up-to-date with what has been submitted