[PATCH] D89066: [Coroutine][Sema] Only tighten the suspend call temp lifetime for final awaiter

JunMa via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 12 01:12:22 PDT 2020


junparser added a comment.

In D89066#2324151 <https://reviews.llvm.org/D89066#2324151>, @lxfind wrote:

> In D89066#2324115 <https://reviews.llvm.org/D89066#2324115>, @junparser wrote:
>
>> why we should not do this with normal await call?
>
> To be honest, I don't know yet. My understanding of how expression cleanup and temp lifetime management is insufficient at the moment.
> But first of all, without adding any cleanup expression here, I saw ASAN failures due to heap-use-after-free, because sometimes the frame have already been destroyed after the await_suspend call, and yet we are still writing into the frame due to unnecessarily cross-suspend lifetime. However, if I apply the cleanup to all await_suepend calls, it also causes ASAN failures as it's cleaning up data that's still alive.
> So this patch is more of a temporary walkaround to stop bleeding without causing any trouble.
> I plan to get back to this latter after I am done with the spilling/alloca issues.

I'm not familiar with ASAN instrumentation. Do you have any testcases to explain this?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89066/new/

https://reviews.llvm.org/D89066



More information about the cfe-commits mailing list