Bug 108669 - driOpenDriver uses RTLD_GLOBAL and breaks clang's libc++
Summary: driOpenDriver uses RTLD_GLOBAL and breaks clang's libc++
Status: RESOLVED MOVED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: 18.0
Hardware: Other All
: medium normal
Assignee: mesa-dev
QA Contact: mesa-dev
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-11-06 00:37 UTC by stsp2
Modified: 2019-09-18 20:27 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description stsp2 2018-11-06 00:37:12 UTC
driOpenDriver() does this:
handle = dlopen(realDriverName, RTLD_NOW | RTLD_GLOBAL)
When "realDriveName" == "radeonsi", we get libstdc++
loaded, because:

$ ldd /usr/lib64/dri/radeonsi_dri.so | grep libstdc++
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f2b2ee30000)

So this dri driver is linked with libstdc++.
RTLD_GLOBAL makes a problem when the main program
or some other lib is built with clang's libc++.
There happens to be a mix of symbols with same name,
and an imminent, hard to debug crash.
Please use RTLD_LOCAL to avoid the problem.

I've found this patch:
https://lists.freedesktop.org/archives/mesa-commit/2014-June/050035.html
which reverts to RTLD_GLOBAL in 3 places.
The problem is described here:
https://lists.freedesktop.org/archives/mesa-dev/2014-May/060441.html
Based on that description, I think it was enough
to use RTLD_GLOBAL only for "libGL.so.1", leaving
other places with RTLD_LOCAL.
Comment 1 GitLab Migration User 2019-09-18 20:27:27 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/1033.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.