[Mesa-dev] [Bug 108669] driOpenDriver uses RTLD_GLOBAL and breaks clang's libc++

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue Nov 6 00:37:12 UTC 2018


https://bugs.freedesktop.org/show_bug.cgi?id=108669

            Bug ID: 108669
           Summary: driOpenDriver uses RTLD_GLOBAL and breaks clang's
                    libc++
           Product: Mesa
           Version: 18.0
          Hardware: Other
                OS: All
            Status: NEW
          Severity: normal
          Priority: medium
         Component: Mesa core
          Assignee: mesa-dev at lists.freedesktop.org
          Reporter: stsp at list.ru
        QA Contact: mesa-dev at lists.freedesktop.org

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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are the QA Contact for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20181106/f872c1bd/attachment.html>


More information about the mesa-dev mailing list