[PATCH libdrm 1/2] configure.ac: error out if pthread-stubs provides a library
Emil Velikov
emil.l.velikov at gmail.com
Mon Oct 31 14:59:50 UTC 2016
From: Emil Velikov <emil.velikov at collabora.com>
If the C runtime doesn't provide the pthread stubs itself, pthread-stubs
will create a library which although it might work is quite fragile and
can cause issues like https://bugs.freedesktop.org/show_bug.cgi?id=98048
Consider the following:
Foo uses pthread-stubs lib (1), then dlopens a module which links
against pthreads (2). After the latter, the pthread-stubs weak symbols
will be overwritten and we'll cause corruption/crashes due to the
mismatch of the API used.
Sometimes the scenario is multiple levels down the dependency chain, be
that 1 and 2 on the same branch or entirely different ones.
Do the robust thing and error out. In practise this shouldn't cause
since any modern runtime provides stub and/or full pthread API in their
libc.so. If that comes to be an issue we can set
PTHREAD_STUBS_{CFLAGS,LIBS} to be the same as the PTHREAD ones.
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
configure.ac | 3 +++
1 file changed, 3 insertions(+)
diff --git a/configure.ac b/configure.ac
index ac6b106..097e944 100644
--- a/configure.ac
+++ b/configure.ac
@@ -62,6 +62,9 @@ LT_INIT([disable-static])
PKG_CHECK_MODULES(PTHREADSTUBS, pthread-stubs)
+if test "x$PTHREADSTUBS_LIBS" != x; then
+ AC_MSG_ERROR([pthread-stubs provides a library. This can cause issues - see freedesktop bug #98048.])
+fi
AC_SUBST(PTHREADSTUBS_CFLAGS)
AC_SUBST(PTHREADSTUBS_LIBS)
--
2.10.0
More information about the dri-devel
mailing list