Bug 349 - Implicit return objects are not released in Slack Mode
: Implicit return objects are not released in Slack Mode
Status: RESOLVED FIXED
: ACPICA
Core/Interpreter
: unspecified
: All Linux
: P2 normal
Assigned To:
:
:
:
:
  Show dependency treegraph
 
Reported: 2006-04-28 23:52 by
Modified: 2008-10-07 22:14 (History)


Attachments
ASL code to reproduce the bug (468 bytes, text/plain)
2006-04-28 23:53, Valery Podrezov
Details
proposed patch (719 bytes, patch)
2007-12-06 18:49, Lin Ming
Details | Diff
proposed patch (720 bytes, patch)
2008-01-04 02:11, Lin Ming
Details | Diff
proposed patch (1.08 KB, patch)
2008-09-11 20:03, Lin Ming
Details | Diff
proposed patch (1.09 KB, patch)
2008-09-18 01:42, Lin Ming
Details | Diff


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2006-04-28 23:52:01
In Slack Mode when an exception occurs and all nested control
methods are terminated, Implicit return objects are not released.

INTERNAL BUG NUMBER:

	210
------- Comment #1 From 2006-04-28 23:53:54 -------
Created an attachment (id=428) [details]
ASL code to reproduce the bug

Run the demo program in Slack Mode: "acpiexec.exe -s gr.aml"
------- Comment #2 From 2007-12-06 18:49:58 -------
Created an attachment (id=751) [details]
proposed patch 
------- Comment #3 From 2007-12-07 09:10:28 -------
Test result:

< ":STST:functional:control:mf6c:PASS:"
< ":STST:functional:control:mf6e:PASS:"
---
> ":STST:functional:control:mf6c:FAIL:Errors # 16 00 00 00:"
> ":STST:functional:control:mf6e:FAIL:Errors # 5C 00 00 00:"
81,83c81,83
< ":STST:functional:control:mf71:PASS:"
< ":STST:functional:control:mff0:PASS:"
< ":STST:functional:control:mff1:PASS:"
---
> ":STST:functional:control:mf71:FAIL:Errors # 16 00 00 00:"
> ":STST:functional:control:mff0:FAIL:Errors # 18 00 00 00:"
> ":STST:functional:control:mff1:FAIL:Errors # 0C 00 00 00:"
1771c1771
< ":STST:Identity2MS:abbu:ms23:FAIL:Errors # 02 00 00 00:"
---
> ":STST:Identity2MS:abbu:ms23:FAIL:Errors # 04 00 00 00:"
2100c2100
< ":STST:bug-demo:Demo of bug 186:mf6d:FAIL:Errors # 04 00 00 00:"
---
> ":STST:bug-demo:Demo of bug 186:mf6d:FAIL:Errors # 06 00 00 00:"
------- Comment #4 From 2008-01-04 02:11:02 -------
Created an attachment (id=766) [details]
proposed patch

Test result:

< ":STST:functional:control:mf6c:PASS:"
< ":STST:functional:control:mf6e:PASS:"
---
> ":STST:functional:control:mf6c:FAIL:Errors # 16 00 00 00:"
> ":STST:functional:control:mf6e:FAIL:Errors # 5C 00 00 00:"
81,83c81,83
< ":STST:functional:control:mf71:PASS:"
< ":STST:functional:control:mff0:PASS:"
< ":STST:functional:control:mff1:PASS:"
---
> ":STST:functional:control:mf71:FAIL:Errors # 16 00 00 00:"
> ":STST:functional:control:mff0:FAIL:Errors # 18 00 00 00:"
> ":STST:functional:control:mff1:FAIL:Errors # 0C 00 00 00:"
1771c1771
< ":STST:Identity2MS:abbu:ms23:FAIL:Errors # 02 00 00 00:"
---
> ":STST:Identity2MS:abbu:ms23:FAIL:Errors # 04 00 00 00:"
2100c2100
< ":STST:bug-demo:Demo of bug 186:mf6d:FAIL:Errors # 04 00 00 00:"
---
> ":STST:bug-demo:Demo of bug 186:mf6d:FAIL:Errors # 06 00 00 00:"
------- Comment #5 From 2008-09-10 22:22:07 -------
re-open this bug.

the patch at #4 has problem, it calls AcpiDsClearImplicitReturn at
AcpiDsMethodDataDeleteAll which never return an implicit return value in slack
mode, it actually disables the slack mode.

It now does not crash in slack mode because we have below code,

/*        
 * In slack mode execution, if there is no return value
 * we should implicitly return zero (0) as a default value.                     
 */
if (AcpiGbl_EnableInterpreterSlack &&
      !PreviousWalkState->ImplicitReturnObj)                                    
{
      PreviousWalkState->ImplicitReturnObj =
          AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
      if (!PreviousWalkState->ImplicitReturnObj)                                
      {     
           return_ACPI_STATUS (AE_NO_MEMORY);                                   
      }     

      PreviousWalkState->ImplicitReturnObj->Integer.Value = 0;                  
}
------- Comment #6 From 2008-09-11 20:03:43 -------
Created an attachment (id=800) [details]
proposed patch

We should not call AcpiDsClearImplicitReturn in AcpiDsMethodDataDeleteAll,
because it removes the implicit return object and so it actually disables the
slack mode.

To fix possible memory leak, just call AcpiDsClearImplicitReturn on method
error, see the patch.
------- Comment #7 From 2008-09-18 01:42:58 -------
Created an attachment (id=802) [details]
proposed patch

see http://bugzilla.kernel.org/0
           Store(0x07D6, OSYS) 
           Method (_CRT, 0, Serialized)
            {
                If (LLess (OSYS, 0x07D6))
                {
                    If (LEqual (\_SB.TJ85, Zero))
                    {
                        Return (Add (0x0AAC, Multiply (TPC, 0x0A)))
                    }
                    Else
                    {
                        Return (Add (0x0AAC, Multiply (TP85, 0x0A)))
                    }
                }
            }

Windows returns 0 (the result of LLess) as implicit return value.
Linux returns 0x07D6 as implicit return.

This patch fixes it to fit windows behavior.
------- Comment #8 From 2008-09-26 19:55:07 -------
ship in ACPICA release 20080926
------- Comment #9 From 2008-10-07 22:14:01 -------
*** Bug 490 has been marked as a duplicate of this bug. ***