[osg-users] osgDB::DynamicLibrary::getLibraryHandle - Crash due to calling dlopen with RTLD_GLOBAL
Robert Osfield
robert.osfield at gmail.com
Mon Sep 21 03:26:33 PDT 2015
Hi Gareth,
I don't recall this being an issue before. What hardware, OS and
OSG/osgEarth versions are you using?
Robert.
On 21 September 2015 at 11:15, Gareth Francis <gfrancis.dev at gmail.com>
wrote:
>
> I believe I found a bug in getLibraryHandle.
>
> This was encountered when writing an osgEarth application, using the
> osgEarthQt widgets (Qt 4.8.6).
>
> A segfault was encountered shortly after starting the application, when
> pressing 's' (To bring up the standard set of rendering stats).
>
> I traced this to the dlopen( localLibraryName.c_str(), RTLD_LAZY |
> RTLD_GLOBAL) call in osg/src/osgDB/DynamicLibrary.cpp
>
> According to the dlopen manpage:
>
> As at glibc 2.21, specifying the *RTLD_GLOBAL *flag when calling
> *dlmopen*() generates an error. Furthermore, specifying *RTLD_GLOBAL*
> when calling *dlopen*() results in a program crash (*SIGSEGV*) if the
> call is made from any object loaded in a namespace other than the
> initial namespace.
>
>
> Changing osg to use RTLD_LOCAL avoids the crash, and doesn't seem to break
> anything else as far as I can tell.
>
> Is there a specific reason why RTLD_GLOBAL is used? This doesn't make much
> sense given the plugin architecture..
>
>
> I've attached a minimal patch including the fix.
>
>
> Thanks
> Gareth Francis
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20150921/6eb3947d/attachment-0003.htm>
More information about the osg-users
mailing list