[Tarantool-patches] [PATCH luajit] core: fix cur_L restoration on error throw

Vitaliia Ioffe v.ioffe at tarantool.org
Thu Aug 19 10:56:09 MSK 2021


Hi team, 
 
QA LGTM
 
 
--
Vitaliia Ioffe
 
  
>Четверг, 19 августа 2021, 10:42 +03:00 от Kirill Yukhin via Tarantool-patches <tarantool-patches at dev.tarantool.org>:
> 
>Hello,
>
>On 16 авг 13:19, Sergey Kaplun wrote:
>> This change is a kind of revertion of commits
>> ed412cd9f55fe87fd32a69c86e1732690fc5c1b0 ('Update cur_L on exceptional
>> path') and 97699d9ee2467389b6aea21a098e38aff3469b5f ('Fix cur_L tracking
>> on exceptional path').
>>
>> When an error is thrown on the coroutine that is not the one being
>> currently executed, `cur_L` is not set up. Hence, when the running trace
>> exits at assertion guard right after the error is caught, Lua state is
>> restored from the incorrect `cur_L`. As a result the resulting stack is
>> inconsistent and the crash occurs.
>>
>> Aforementioned patches fix the behaviour only for x86/x64
>> architectures. This patch updates the `cur_L` within `lj_err_throw()` to
>> the given lua_State, where the error is raised, since this is the only
>> coroutine that can proceed later. Also, it removes unnecessary
>> restorations of `cur_L` at C and FF exception handlers in the VM.
>>
>> Nevertheless, throwing an error at non-currently executed coroutine is a
>> violation of Lua/C API. So, in the nearest possible future this patch
>> should be replaced within the corresponding assert.
>>
>> Resolves tarantool/tarantool#6189
>> Relates to tarantool/tarantool#6323
>> Follows up tarantool/tarantool#1516
>LGTM.
>
>--
>Regards, Kirill Yukhin
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20210819/730673b3/attachment.htm>


More information about the Tarantool-patches mailing list