ACK: FADT table checksum corrupted when FACS table is faked
Colin Ian King
colin.king at canonical.com
Mon Nov 23 11:57:39 UTC 2015
On 19/11/15 14:28, Jiri Vohanka wrote:
> Hello,
>
> I discovered a problem in src/lib/src/fwts_acpi_tables.c that causes
> a false FAIL in the 'checksum' test.
>
> If a FACS ACPI table is not found, a fake one is created and a fake
> physical
> address is assigned to it. This fake physical address is written to
> FIRMWARE_CTRL and X_FIRMWARE_CTRL fields of FADT table:
>
> facs_fake_addr = fwts_fake_physical_addr(size);
> fadt->firmware_control = (uint32_t)facs_fake_addr;
> if (fadt->header.length >= 140)
> fadt->x_firmware_ctrl = (uint64_t)facs_fake_addr;
>
> (By the way, the ACPI 6.0 specification states that only one of
> FIRMWARE_CTRL,
> X_FIRMWARE_CTRL could be nonzero.)
> The problem is that the checksum of the FADT table is not updated to
> reflect
> the change in 'firmware_control' and 'x_firmware_ctrl' fields.
>
> I created a patch that changes the update of physical address of FACS in
> FADT.
> It tries to use the physical address from 'x_firmware_ctrl' and
> 'firmware_control' fields of FADT table. If both fields are zero then
> a fake physical address is assigned to FACS, written to FADT table and the
> checksum of FADT is updated.
>
> Unpatched test:
> No FACS found, fwts has faked one instead.
> ...
> FAILED [MEDIUM] ACPITableChecksum: Test 1, Table FACP has incorrect
> checksum,
> expected 0xe8, got 0xcf.
>
> Patched test:
> No FACS found, fwts has faked one instead.
> ...
> PASSED: Test 1, Table FACP has correct checksum 0xcf
>
> Regards,
> Jiri Vohanka
>
>
I've verified this works against the fwts regression tests and also by
dumping my ACPI tables, and removing the FACP, and running
fwts --dumpfile=acpidump.log checksum -
this patch fixes the issue, so I'm happy to ACK it. I
BTW, Alex, I don't think it needs to be re-sent. I can apply it using
git-am into my fwts git repo.
Acked-by: Colin Ian King <colin.king at canonical.com>
More information about the fwts-devel
mailing list