[tor-commits] [sandboxed-tor-browser/master] Bug 20776: Remove the X11 `MIT-SHM` workaround from the stub.

yawning at torproject.org yawning at torproject.org
Mon Jun 19 11:33:38 UTC 2017


commit 6903227f8f0a1c06fe19aa26268195e47cc3b3b1
Author: Yawning Angel <yawning at schwanenlied.me>
Date:   Mon Jun 19 11:30:52 2017 +0000

    Bug 20776: Remove the X11 `MIT-SHM` workaround from the stub.
    
    ESR52 has the workarounds for the libcairo brain damage, and thanks to
    level.
---
 ChangeLog               |  1 +
 src/tbb_stub/tbb_stub.c | 34 ----------------------------------
 2 files changed, 1 insertion(+), 34 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index aea7c74..edae37e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,5 @@
 Changes in version 0.0.8 - UNRELEASED:
+ * Bug 20776: Remove the X11 `MIT-SHM` workaround from the stub.
  * Bug 22648: Prevent the "easy" to fix X11 related sandbox escapes.
  * Bug 22650: Make it clear that Pulse Audio is potentially dangerous
    to enable.
diff --git a/src/tbb_stub/tbb_stub.c b/src/tbb_stub/tbb_stub.c
index 63f2d42..e7ca733 100644
--- a/src/tbb_stub/tbb_stub.c
+++ b/src/tbb_stub/tbb_stub.c
@@ -47,13 +47,11 @@
 #include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <X11/Xlib.h>
 
 static pthread_once_t stub_init_once = PTHREAD_ONCE_INIT;
 static int (*real_connect)(int, const struct sockaddr *, socklen_t) = NULL;
 static int (*real_socket)(int, int, int) = NULL;
 static void *(*real_dlopen)(const char *, int) = NULL;
-static Bool (*real_XQueryExtension)(Display*, _Xconst char*, int*, int*, int*) = NULL;
 static struct sockaddr_un socks_addr;
 static struct sockaddr_un control_addr;
 
@@ -159,24 +157,6 @@ dlopen(const char *filename, int flags)
   return ret;
 }
 
-Bool
-XQueryExtension(Display *display, _Xconst char *name, int *major, int *event, int *error) {
-  pthread_once(&stub_init_once, stub_init);
-
-  if (!strcmp(name, "MIT-SHM")) {
-    *major = 0;
-    return False;
-  }
-
-  return real_XQueryExtension(display, name, major, event, error);
-}
-
-Bool
-XShmQueryExtension(Display* display) {
-  (void)display;
-  return False;
-}
-
 /* There are rumors that PI futexes have scary race conditions, that enable
  * an exploit that is being sold by the forces of darkness.  On systems where
  * we can filter futex kernel args, we reject such calls.
@@ -255,7 +235,6 @@ stub_init(void)
   char *socks_path = secure_getenv("TOR_STUB_SOCKS_SOCKET");
   char *control_path = secure_getenv("TOR_STUB_CONTROL_SOCKET");
   size_t dest_len = sizeof(socks_addr.sun_path);
-  void *handle = NULL;
 
   /* If `TOR_STUB_SOCKS_SOCKET` isn't set, bail. */
   if (socks_path == NULL) {
@@ -302,19 +281,6 @@ stub_init(void)
     goto out;
   }
 
-  /* Firefox does not degrade gracefully when "MIT-SHM" fails.
-   *
-   * See: https://bugzilla.mozilla.org/show_bug.cgi?id=1271100#c20
-   */
-  if ((handle = real_dlopen("libXext.so.6", RTLD_LAZY)) == NULL) {
-    fprintf(stderr, "ERROR: Failed to dlopen() libXext.so: %s\n", dlerror());
-    goto out;
-  }
-  if ((real_XQueryExtension = dlsym(handle, "XQueryExtension")) == NULL) {
-    fprintf(stderr, "ERROR: Failed to find `XQueryExtension()` symbol: %s\n", dlerror());
-    goto out;
-  }
-
   return;
 
 out:



More information about the tor-commits mailing list