binaryninja-api: Crash likely caused by stack overflow in recursive functions (or using Intel i9-13900K/14900K CPU)

Version and Platform (required):

  • Binary Ninja Version: 4.1.5339-dev Personal and 4.0.4958-stable Personal
  • OS: Windows 11
  • OS Version: 10.0.22631 N/A Build 22631
  • CPU Architecture: x64

Bug Description:

Binary Ninja crashes when loading ntoskrnl.exe after 10-15 seconds.

Steps To Reproduce:

  1. Go to “File”
  2. Click on “Open”
  3. Select ntoskrnl.exe
  4. Wait for Binary Ninja to crash

Expected Behavior:

The expected behavior is that it should not crash.

Additional Information:

Stack trace output from WinDbg on version: 4.1.5339-dev

This exception may be expected and handled.
binaryninjacore!BNRegisterGlobalFunctionRecognizer+0x1b09e:
00007ffa`31006aae 498b4f50        mov     rcx,qword ptr [r15+50h] ds:00000000`00000050=????????????????
0:046> k
 # Child-SP          RetAddr               Call Site
00 00000020`155fe290 00007ffa`31009943     binaryninjacore!BNRegisterGlobalFunctionRecognizer+0x1b09e
01 00000020`155fe6c0 00007ffa`30ffe94b     binaryninjacore!BNRegisterGlobalFunctionRecognizer+0x1df33
02 00000020`155feaa0 00007ffa`307d07d8     binaryninjacore!BNRegisterGlobalFunctionRecognizer+0x12f3b
03 00000020`155fee00 00007ffa`3100855e     binaryninjacore+0x5607d8
04 00000020`155fef00 00007ffa`3100828d     binaryninjacore!BNRegisterGlobalFunctionRecognizer+0x1cb4e
05 00000020`155ff040 00007ffa`3118355b     binaryninjacore!BNRegisterGlobalFunctionRecognizer+0x1c87d
06 00000020`155ff1a0 00007ffa`30f3f646     binaryninjacore!BNGetHighLevelILVariables+0x31c7b
07 00000020`155ff5c0 00007ffa`30f0fb9e     binaryninjacore!BNSetFlowGraphNodeLines+0xf7926
08 00000020`155ff720 00007ffa`315e821e     binaryninjacore!BNSetFlowGraphNodeLines+0xc7e7e
09 00000020`155ff750 00007ffa`3178e4a8     binaryninjacore!BNTagTypeSetVisible+0x4f2e
0a 00000020`155ff7e0 00007ffa`31789201     binaryninjacore!BNWriteWebsocketClientData+0x85b8
0b 00000020`155ff930 00007ffb`07679333     binaryninjacore!BNWriteWebsocketClientData+0x3311
0c 00000020`155ff960 00007ffb`093e257d     ucrtbase!thread_start<unsigned int (__cdecl*)(void *),1>+0x93
0d 00000020`155ff990 00007ffb`0a0caa48     KERNEL32!BaseThreadInitThunk+0x1d
0e 00000020`155ff9c0 00000000`00000000     ntdll!RtlUserThreadStart+0x28

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 41 (27 by maintainers)

Most upvoted comments

FYI I was also experiencing crashes with one particular game, a thread suggested updating my BIOS which has fixed both the game and the loading of the .bndb that was crashing mentioned above. This is back on a worker thread count of 31 with 4.1.5575-dev.

Thanks for the updates, glad it’s resolved! We’ll add a note to our troubleshooting documentation shortly.

I have asked my colleauges to try to reproduce it, so far no progress yet.

As for a TTD recording, we will be shipping a feature that lets you do a TTD recording within BN directly. Which I think might be helpful because you can make the trace file smaller by starting the recording later on, rather than from the launch of binja. This feature is not originally intended to be used as such – it is just an coincidence. I will try to update on this no later than next Monday

Could you try something in between, like 8, 16, or 24?

8 - No crash 16 - Crash (Took a few tries) 24 - Crash (First try)

If this is an issue with multi threading I’m assuming its possible for it to crash with lower amount of threads but its just less likely. However, I could not get this to happen but I could try more if you would like.

These are very valuable data points! Now I am more inclined to believe this is related to the thread count, and not tied to the specific CPU. Surprisingly I have a Intel i7-13700K which has 24 threads, and I cannot for even once reproduce it. I will try harder and see if I can reproduce it.

I will also look at your crash dumps and see if I can get any clues. In the worst case, if we still cannot figure it out, we may ask you to do a TTD (https://learn.microsoft.com/en-us/windows-hardware/drivers/debuggercmds/time-travel-debugging-overview) recording of the crash and share with us a trace of the execution. More on that later.

I just tried and I was unable to reproduce it on free.

Thx. The free version has some thread count limit so it probably affects it. If you have other computers, can you test if you can reproduce it with the regular (personal/commercial) version binja? I am still trying to figure out the factors that affect the bug