[Tarantool-patches] [PATCH luajit] FFI: Workaround for platform dlerror() returning NULL.

Sergey Bronnikov sergeyb at tarantool.org
Tue Sep 17 09:31:29 MSK 2024


Hi, Sergey,

On 13.09.2024 18:32, Sergey Kaplun wrote:
> Hi, Sergey!
> Thanks for the review!
>
> On 13.09.24, Sergey Bronnikov wrote:
>> Hi, Sergey,
>>
>> thanks for the patch! LGTM with a minor comment below.
>>
>> On 13.09.2024 11:05, Sergey Kaplun wrote:
>>> From: Mike Pall <mike>
>>>
>>> Contributed by mcclure.
>>>
>>> (cherry picked from commit 478bcfe52a653bf338f17690147fa9f5793f5b42)
>>>
>>> The `ffi.load()` implementation assumes the string returned from
>>> `dlerror()` is non-NULL and immediately dereferences it. This may lead
>>> to a crash on some platforms like Android (Oculus Quest) where it is
>>> possible.
>> According to a POSIX standard, it is not Android-specific behaviour [1]:
>>
>>   > If no dynamic linking errors have occurred since the last invocation
>> of /dlerror/(), /dlerror/() shall return NULL.
>>
>> 1.https://pubs.opengroup.org/onlinepubs/009695399/functions/dlerror.html
> Updated the commit message to the following and force-pushed the branch:
Thanks! LGTM
>
> | FFI: Workaround for platform dlerror() returning NULL.
> |
> | Contributed by mcclure.
> |
> | (cherry picked from commit 478bcfe52a653bf338f17690147fa9f5793f5b42)
> |
> | The `ffi.load()` implementation assumes the string returned from
> | `dlerror()` is non-NULL and immediately dereferences it. This may lead
> | to a crash on POSIX platforms [1] where it is possible.
> |
> | This patch adds the corresponding check and the default "dlopen failed"
> | error message.
> |
> | Sergey Kaplun:
> | * added the description and the test for the problem
> |
> | [1]:https://pubs.opengroup.org/onlinepubs/009695399/functions/dlerror.html
> |
> | Part of tarantool/tarantool#10199
>
>
>>> This patch adds the corresponding check and the default "dlopen failed"
>>> error message.
>>>
>>> Sergey Kaplun:
>>> * added the description and the test for the problem
>>>
>>> Part of tarantool/tarantool#10199
>>> ---
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20240917/297b368f/attachment.htm>


More information about the Tarantool-patches mailing list