DynamoRIO / dynamorio

Dynamic Instrumentation Tool Platform
Other
2.63k stars 557 forks source link

Invariant failure: "An unfiltered thread should have at least 1 instruction" #6622

Closed derekbruening closed 8 months ago

derekbruening commented 8 months ago

This showed up in my new test in PR #6598 but it seems a general issue that could show up anywhere with a detach or other non-syscall exit:

https://github.com/DynamoRIO/dynamorio/actions/runs/7749549688/job/21134306402?pr=6598

273:   *** postcmd failed (3): Trace invariant failure in T3104 at ref # 99016 (0
273:   instrs since timestamp 13351308211805717): An unfiltered thread should have
273:   at least 1 instruction

It looks like a general bug: the check doesn't consider unfetched or prefetches, which are copied into previnstr. The exit-early case in this test probably made it more likely: need a no-fetch instr right before thread exit.