[PATCH] D104184: [Coroutine] Put byval params' value into frame, instead of just pointer
Xun Li via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 12 10:12:37 PDT 2021
lxfind created this revision.
lxfind added reviewers: ChuanqiXu, rjmccall, nikic.
Herald added subscribers: hoy, modimo, wenlei, hiraditya.
lxfind requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This patch is to address https://bugs.llvm.org/show_bug.cgi?id=48857.
A previous attemp is in D104007 <https://reviews.llvm.org/D104007>.
If a parameter needs to live across coroutine suspensions, we put the parameter on the coroutine frame.
However for byval parameters, it's insufficient to just put the parameter itself on the frame, because byval param is essentially like an alloca where the memory belongs to this coroutine.
We need to treat them like allocas, and put their value content in the frame, instead of just the parameter pointer.
This will fix the bug where memcpy from a byval param to a local alloca triggers memory use-after-free after a coroutien suspension.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D104184
Files:
llvm/lib/Transforms/Coroutines/CoroFrame.cpp
llvm/test/Transforms/Coroutines/coro-byval-param.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104184.351671.patch
Type: text/x-patch
Size: 10030 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210612/52a64668/attachment.bin>
More information about the llvm-commits
mailing list