Skip to content
Permalink
Browse files

Disassembler: Abort on an invalid/unknown AML opcode

An invalid opcode indicates something seriously wrong with the
input AML file. The AML parser is immediately confused and lost,
causing the resulting parse tree to be ill-formed. The actual
disassembly can then cause numerous unrelated errors and faults.

This change aborts the disassembly upon discovery of such an
opcode during the AML parse phase.
  • Loading branch information...
acpibob committed Apr 6, 2017
1 parent b067fe1 commit ed0389cb11a61e63c568ac1f67948fc6a7bd1aeb
Showing with 15 additions and 0 deletions.
  1. +15 −0 source/components/parser/psobject.c
@@ -237,12 +237,23 @@ AcpiPsGetAmlOpcode (
WalkState->Opcode,
(UINT32) (AmlOffset + sizeof (ACPI_TABLE_HEADER)));

ACPI_ERROR ((AE_INFO,
"Aborting disassembly, AML byte code is corrupt"));

/* Dump the context surrounding the invalid opcode */

AcpiUtDumpBuffer (((UINT8 *) WalkState->ParserState.Aml - 16),
48, DB_BYTE_DISPLAY,
(AmlOffset + sizeof (ACPI_TABLE_HEADER) - 16));
AcpiOsPrintf (" */\n");

/*
* Just abort the disassembly, cannot continue because the
* parser is essentially lost. The disassembler can then
* randomly fail because an ill-constructed parse tree
* can result.
*/
return_ACPI_STATUS (AE_AML_BAD_OPCODE);
#endif
}

@@ -458,6 +469,10 @@ AcpiPsCreateOp (
{
return_ACPI_STATUS (AE_CTRL_PARSE_CONTINUE);
}
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}

/* Create Op structure and append to parent's argument list */

0 comments on commit ed0389c

Please sign in to comment.
You can’t perform that action at this time.