From: Colin Walters Date: Fri, 28 Sep 2012 01:35:22 +0000 (-0400) Subject: hardening: Ensure _dbus_check_setuid() is initialized threadsafe manner X-Git-Tag: dbus-1.4.24~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f2c505f24f46d316df9ba5022c17062b9bd7939b;p=thirdparty%2Fdbus.git hardening: Ensure _dbus_check_setuid() is initialized threadsafe manner This is a highly theoretical concern, but we might as well. https://bugs.freedesktop.org/show_bug.cgi?id=52202 Conflicts: dbus/dbus-sysdeps-pthread.c --- diff --git a/dbus/dbus-sysdeps-pthread.c b/dbus/dbus-sysdeps-pthread.c index 70737512e..6e5d209ec 100644 --- a/dbus/dbus-sysdeps-pthread.c +++ b/dbus/dbus-sysdeps-pthread.c @@ -359,6 +359,11 @@ check_monotonic_clock (void) dbus_bool_t _dbus_threads_init_platform_specific (void) { + /* These have static variables, and we need to handle both the case + * where dbus_threads_init() has been called and when it hasn't; + * so initialize them before any threads are allowed to enter. + */ check_monotonic_clock (); + (void) _dbus_check_setuid (); return dbus_threads_init (&pthread_functions); }