[PATCH libdrm 1/2] configure.ac: error out if pthread-stubs provides a library

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Emil Velikov <emil.velikov@xxxxxxxxxxxxx>

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

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux