strcmp used instead of ACPI_COMPARE_NAMESEG

Bug #1851219 reported by BenjaminBerg
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Firmware Test Suite
Fix Released
Medium
Colin Ian King

Bug Description

In aslmethod.c there are two cases where strcmp is used. However, these should be strncmp or better ACPI_COMPARE_NAMESEG, resulting in the branches to be never reached.

> ./acpica/source/compiler/aslmethod.c: if (!strcmp (METHOD_NAME__HID, Op->Asl.NameSeg))
> ./acpica/source/compiler/aslmethod.c: else if (!strcmp (METHOD_NAME__CID, Op->Asl.NameSeg))

This issue was found by Red Hat's compiler team recompiling the package against gcc-10.

Revision history for this message
Colin Ian King (colin-king) wrote :

Thanks for reporting this issue. The ACPICA source is from the ACPICA project, do you mind build testing the original ACPICA source against gcc-10 and filing a bug against this at https://bugs.acpica.org if the same issue is found.

Changed in fwts:
importance: Undecided → Medium
status: New → Triaged
assignee: nobody → Colin Ian King (colin-king)
Revision history for this message
BenjaminBerg (benjamin-sipsolutions) wrote :
Revision history for this message
Colin Ian King (colin-king) wrote :

Thanks Benjamin, much appreciated!

Revision history for this message
Colin Ian King (colin-king) wrote :

Which version of gcc-10 are you using? I can't reproduce this with http://kayari.org/gcc-latest/gcc-latest_10.0.0-20191027svn277495.deb

Revision history for this message
BenjaminBerg (benjamin-sipsolutions) wrote :

I don't know to be honest. Fedora also sets a number of hardening warnings/error flags, so quite likely, this only happens because of those.

I can ask for details, but they have not been provided to me so far. That said, I think the bug is actually quite obvious in this case, even if it may not be found with your compile flags.

Revision history for this message
Colin Ian King (colin-king) wrote :

OK. Just for reference, it would be useful to know the hardening flags so I can ensure fwts is built with these to try to catch these in the future.

Revision history for this message
Colin Ian King (colin-king) wrote :

Fix has landed in ACPICA, will bring it over to fwts now.

commit 3dcd13aa62e70294e194ebc0cf16dd33c90b17ab
Author: Robert Moore <email address hidden>
Date: Fri Nov 8 07:33:54 2019 -0800

    iASL: Use ACPI_COMPARE_NAMESEG instead of strcmp

    For _HID, _CID processing. Reported by Benjamin Berg
    (<email address hidden>).

diff --git a/source/compiler/aslmethod.c b/source/compiler/aslmethod.c
index 667eaaaf8..4b29fc9e7 100644
--- a/source/compiler/aslmethod.c
+++ b/source/compiler/aslmethod.c
@@ -586,7 +586,7 @@ MtMethodAnalysisWalkBegin (

         /* Special typechecking for _HID */

- if (!strcmp (METHOD_NAME__HID, Op->Asl.NameSeg))
+ if (ACPI_COMPARE_NAMESEG (METHOD_NAME__HID, Op->Asl.NameSeg))
         {
             Next = Op->Asl.Child->Asl.Next;
             AnCheckId (Next, ASL_TYPE_HID);
@@ -594,7 +594,7 @@ MtMethodAnalysisWalkBegin (

         /* Special typechecking for _CID */

- else if (!strcmp (METHOD_NAME__CID, Op->Asl.NameSeg))
+ else if (ACPI_COMPARE_NAMESEG (METHOD_NAME__CID, Op->Asl.NameSeg))
         {
             Next = Op->Asl.Child->Asl.Next;

Revision history for this message
Colin Ian King (colin-king) wrote :

Patch waiting for review on fwts-devel mailing list: https://lists.ubuntu.com/archives/fwts-devel/2019-November/011616.html

Changed in fwts:
status: Triaged → In Progress
Changed in fwts:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.