Mir

Comment 5 for bug 1526658

Revision history for this message
Daniel van Vugt (vanvugt) wrote : Re: mir may use incompatible client platform to validate server display

Oooh, I see the problem:

Mir does not care what the client-platform file names are. It loads and searches them all, including your mesa.so.2

While the Mir code internally correctly uses dlvsym to restrict the symbol versions it's willing to use, the Mesa code does not check the symbol versions:

+#ifdef HAVE_MIR_PLATFORM
+static EGLBoolean
+_mir_display_is_valid(EGLNativeDisplayType nativeDisplay)
+{
+ typedef int (*MirEGLNativeDisplayIsValidFunc)(MirMesaEGLNativeDisplay*);
+
+ void *lib;
+ MirEGLNativeDisplayIsValidFunc general_check;
+ MirEGLNativeDisplayIsValidFunc client_check;
+ MirEGLNativeDisplayIsValidFunc server_check;
+ EGLBoolean is_valid = EGL_FALSE;
+
+ lib = dlopen(NULL, RTLD_LAZY);
+ if (lib == NULL)
+ return EGL_FALSE;
+
+ general_check = (MirEGLNativeDisplayIsValidFunc) dlsym(lib, "mir_egl_mesa_display_is_valid");
+ client_check = (MirEGLNativeDisplayIsValidFunc) dlsym(lib, "mir_client_mesa_egl_native_display_is_valid");
+ server_check = (MirEGLNativeDisplayIsValidFunc) dlsym(lib, "mir_server_mesa_egl_native_display_is_valid");
+

Mesa will find the first one in your address space. And that may well be mesa.so.2 it finds before mesa.so.3.

So we either need to:
  * avoid loading old modules according to file name, or
  * enhance egl-platform-mir.patch to to use dlvsym instead of dlsym, or
  * aggressively unload modules, ensuring they are not present in memory except while they're being probed.

I suspect the third option is best. I noticed a problem like that the other day anyway -- client processes seem to have all client modules loaded. We're leaking them I think.