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

Sergey Kaplun skaplun at tarantool.org
Fri Sep 13 18:32:39 MSK 2024


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:

| 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
> > ---

-- 
Best regards,
Sergey Kaplun


More information about the Tarantool-patches mailing list