25.01.2013 23:36, Andreas Beckmann kirjoitti:
> Control: tag -1 moreinfo
> 
> Hi Anssi,

Hi!

> On 2012-03-06 02:10, Anssi Hannula wrote:
>> Testcase attached. Also, this is a libvdpau bug, not a
>> nvidia-vdpau-driver one. It crashes with all drivers, whether VDPAU is
>> supported or not (as the bug is caused by the probing code in libvdpau).
> 
> I just noticed that there is now an upstream commit that should fix this
> (3b43955c7324e1d213a3134387767722f34e2356), but so far I could still
> reproduce the segfault with your test program.
> Anyway, I just uploaded (to experimental) 0.5-1 including all upstream
> commits that were done after the upstream release of 0.5.
> 
> Perhaps you can have a look at this again.

There is an identical issue in libXext.so which is triggered by the use
of Xext in libvdpau.so.

Aaron Plattner from upstream has posted a testcase which workarounds the
libXext.so issue:
http://lists.freedesktop.org/archives/vdpau/2013-January/000045.html

The libXext.so issue can be reproduced easily without libvdpau
involvement by dlopening it, calling e.g. XGEQueryVersion() or
XSyncQueryExtension() (two examples I just randomly picked up), and then
dlclosing it before calling XCloseDisplay(). Testcase attached for that.

I'm not 100% sure if this is even supposed to work, but at the very
least it is rather fishy. Anyway, the libvdpau part has been fixed, and
it of course fixes the issue on all those cases where the main program
is directly linked against libXext.so.6 (which I guess most VDPAU users
are, except for my testcase) as that the libXext callbacks will always
be present at XCloseDisplay() time.

-- 
Anssi Hannula
/*
 * Testcase for libXext segmentation fault on unload due to handlers
 * installed to be run at display close time.
 *
 * Written by Anssi Hannula <an...@mageia.org>
 *
 * gcc -o libxext-dlopen-crash libxext-dlopen-crash.c -lX11 -ldl
 */

#include <X11/Xlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>

int main() {
	Display *dpy;
	void *libxext;
	char *error;
	int a, b;
	Bool (*XGEQueryVersion)(Display* dpy, int *major, int* minor);
	Status (*XSyncQueryExtension)(Display*, int *event_base_return, int *error_base_return);

	dpy = XOpenDisplay(NULL);
	if (!dpy) {
		fprintf(stderr, "Unable to open display.");
		return EXIT_FAILURE;
	}

	libxext = dlopen("libXext.so.6", RTLD_LAZY);
	if (!libxext) {
		fprintf(stderr, "%s\n", dlerror());
		return EXIT_FAILURE;
	}

	*(void **) (&XGEQueryVersion) = dlsym(libxext, "XGEQueryVersion");
	if ((error = dlerror()) != NULL) {
		fprintf(stderr, "%s\n", error);
		return EXIT_FAILURE;
	}

	*(void **) (&XSyncQueryExtension) = dlsym(libxext, "XSyncQueryExtension");
	if ((error = dlerror()) != NULL) {
		fprintf(stderr, "%s\n", error);
		return EXIT_FAILURE;
	}

	// Either of these is enough to cause a crash. Test both of them.
	XGEQueryVersion(dpy, &a, &b);
	XSyncQueryExtension(dpy, &a, &b);

	if (dlclose(libxext)) {
		fprintf(stderr, "%s\n", dlerror());
		return EXIT_FAILURE;
	}

	puts("Calling XCloseDisplay() - this will segfault if handlers were installed.");
	XCloseDisplay(dpy);

	return 0;
}

Reply via email to