-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Description
ASan & HWASan instrumentation passes both contain logic to move all static allocas over to a dynamically allocated stack frame which can be used to support stack use-after-return detection. In the entry block, it introduces a runtime check if/else pattern to select between dynamically allocated stack memory and heap allocated memory when UAR detection is enabled.
This conflicts with the CoroSplit pass logic, which emits a fatal error for dynamic allocas, which would have to be heap allocated (i.e. rewrite to malloc) to live across suspend points.
There's something obvious here: The passes are both fundamentally doing the same thing. They are moving all stack allocations to the heap.
Normally the pass sequence is corosplit, then sanitizer instruentation. However, to be resilient to odd pass reorderings, it would be better if sanitizer passes simply didn't do UAR detection on pre-split coroutines. This eliminates the pass ordering requirement completely.
Right now, ASan is blind to bugs in coroutine functions in LTO configurations, because we just skip instrumenting pre-split coroutines. Fixing this would improve its defect detection capability.
References:
- [hwasan] Port "[Asan] Skip pre-split coroutine and noop coroutine frame (#99415)" #154803
- [Asan] Skip pre-split coroutine and noop coroutine frame #99415
- aa0776d
One thing I'm not clear on is whether we can retain redzone poisoning in all coro / sanitizer pass sequencings.