hardening: Ensure _dbus_check_setuid() is initialized threadsafe manner
authorColin Walters <walters@verbum.org>
Fri, 28 Sep 2012 01:35:22 +0000 (21:35 -0400)
committerColin Walters <walters@verbum.org>
Fri, 28 Sep 2012 16:55:38 +0000 (12:55 -0400)
This is a highly theoretical concern, but we might as well.

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

dbus/dbus-sysdeps-pthread.c

index c9ec9e5..c60457b 100644 (file)
@@ -275,6 +275,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 (NULL);
 }