Skip to content

Commit dbbd4be

Browse files
xusheng6claude
andcommitted
[emulator] Stop after a call stub/hook requests a stop
In the CALL/CALL_STACK_ADJUST/TAILCALL cases, a builtin stub or the call hook can request a stop (e.g. on an error) while returning false, but the code only checked the boolean return and fell through into the call/tailcall path, executing further despite the pending stop. Check m_stopReason after the stub and hook handling and return if a stop was requested. Addresses bdash review comment on PR #8314. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 3beaa12 commit dbbd4be

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

plugins/emulator/core/llilemulator.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1888,6 +1888,11 @@ void LLILEmulator::ExecuteCurrentInstruction()
18881888
if (m_callHook && m_callHook(this, dest))
18891889
break;
18901890

1891+
// A builtin stub or call hook may have requested a stop (e.g. an error) without
1892+
// returning true; don't fall through into the call in that case.
1893+
if (m_stopReason != ILEmulatorStopReason::Running)
1894+
return;
1895+
18911896
// 3) Try to enter the callee's LLIL
18921897
{
18931898
// Compute return address before EnterFunction changes m_il/m_arch
@@ -1939,6 +1944,11 @@ void LLILEmulator::ExecuteCurrentInstruction()
19391944
break;
19401945
}
19411946

1947+
// A builtin stub or call hook may have requested a stop (e.g. an error) without
1948+
// returning true; don't fall through into the call in that case.
1949+
if (m_stopReason != ILEmulatorStopReason::Running)
1950+
return;
1951+
19421952
{
19431953
uint64_t returnAddr = GetNativeReturnAddress();
19441954
size_t addrSize = m_arch->GetAddressSize();
@@ -1980,6 +1990,11 @@ void LLILEmulator::ExecuteCurrentInstruction()
19801990
if (m_callHook && m_callHook(this, dest))
19811991
break;
19821992

1993+
// A builtin stub or call hook may have requested a stop (e.g. an error) without
1994+
// returning true; don't fall through into the tailcall in that case.
1995+
if (m_stopReason != ILEmulatorStopReason::Running)
1996+
return;
1997+
19831998
// Tailcall: don't push a frame, replace current function
19841999
if (m_view)
19852000
{

0 commit comments

Comments
 (0)