[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#699375: unblock: libvdpau/0.4.1-8



Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock

Please unblock package libvdpau

Hi,

libvdpau may cause a segfault if it is dlopen()ed and thereafter
dlclosed() before XCloseDisplay() is called. See the patch description
for more details.

I've cherry-picked a patch from upstream git that fixes this. Thanks go
to Anssi Hannula who wrote a small testcase to demonstrate the problem
and explained me how I could check that it is actually fixed with this
patch.

Andreas

unblock libvdpau/0.4.1-8
diffstat for libvdpau-0.4.1 libvdpau-0.4.1

 changelog                                                      |   12 -
 control                                                        |    3 
 copyright                                                      |    4 
 libvdpau1.symbols                                              |    1 
 patches/0003-Fix-leaked-extension-info-on-library-unload.patch |  113 ++++++++++
 patches/series                                                 |    2 
 6 files changed, 130 insertions(+), 5 deletions(-)

diff -Nru libvdpau-0.4.1/debian/changelog libvdpau-0.4.1/debian/changelog
--- libvdpau-0.4.1/debian/changelog	2012-08-16 02:21:22.000000000 +0200
+++ libvdpau-0.4.1/debian/changelog	2013-01-27 01:49:31.000000000 +0100
@@ -1,3 +1,13 @@
+libvdpau (0.4.1-8) unstable; urgency=low
+
+  * Update my email address and remove DMUA.
+  * Cherry-pick upstream commit 837c63d from 0.5+git:
+    0003-Fix-leaked-extension-info-on-library-unload.patch  (Closes: #592204)
+  * libvdpau1.symbols: Add _vdp_DRI2RemoveExtension, added in above patch.
+  * Change Upstream-Contact to vdpau@lists.freedesktop.org.
+
+ -- Andreas Beckmann <anbe@debian.org>  Sun, 27 Jan 2013 01:49:23 +0100
+
 libvdpau (0.4.1-7) unstable; urgency=low
 
   * The last (and only) reverse dependency of lib32vdpau1 was the non-free
@@ -53,7 +63,7 @@
     (Closes: #616264)
   * track_dynamic_library_handles_and_free_them_on_exit.patch: Pick upstream
     commit 4262513e: "vdpau_wrapper.c: Track dynamic library handles and free
-    them on exit using __attribute__((destructor))".  This could fix #592204.
+    them on exit using __attribute__((destructor))".
   * Switch to debhelper 8.
   * Switch to dh-autoreconf: add to B-D, use dh --with autoreconf and drop
     autoreconf_-fi.patch.
diff -Nru libvdpau-0.4.1/debian/control libvdpau-0.4.1/debian/control
--- libvdpau-0.4.1/debian/control	2012-08-16 02:21:22.000000000 +0200
+++ libvdpau-0.4.1/debian/control	2013-01-27 01:49:31.000000000 +0100
@@ -6,8 +6,7 @@
  Jean-Yves Avenard <jyavenard@gmail.com>,
  Andres Mejia <amejia@debian.org>,
  Russ Allbery <rra@debian.org>,
- Andreas Beckmann <debian@abeckmann.de>,
-DM-Upload-Allowed: yes
+ Andreas Beckmann <anbe@debian.org>,
 Build-Depends:
  debhelper (>= 9),
  dh-autoreconf,
diff -Nru libvdpau-0.4.1/debian/copyright libvdpau-0.4.1/debian/copyright
--- libvdpau-0.4.1/debian/copyright	2012-08-16 02:21:22.000000000 +0200
+++ libvdpau-0.4.1/debian/copyright	2013-01-27 01:49:31.000000000 +0100
@@ -1,6 +1,6 @@
 Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
 Upstream-Name: VDPAU wrapper and trace libraries
-Upstream-Contact: Aaron Plattner <aplattner@nvidia.com>
+Upstream-Contact: <vdpau@lists.freedesktop.org>
 Source: http://people.freedesktop.org/~aplattner/vdpau/
 
 Files: *
@@ -10,7 +10,7 @@
 
 Files: debian/*
 Copyright: 2009-2012 Andres Mejia <mcitadel@gmail.com>
-           2010-2012 Andreas Beckmann <debian@abeckmann.de>
+           © 2010-2013 Andreas Beckmann <anbe@debian.org>
            2010 Russ Allbery <rra@debian.org>
 License: Expat
 
diff -Nru libvdpau-0.4.1/debian/libvdpau1.symbols libvdpau-0.4.1/debian/libvdpau1.symbols
--- libvdpau-0.4.1/debian/libvdpau1.symbols	2012-08-16 02:21:22.000000000 +0200
+++ libvdpau-0.4.1/debian/libvdpau1.symbols	2013-01-27 01:49:31.000000000 +0100
@@ -2,6 +2,7 @@
  _vdp_DRI2Connect@Base 0.4
  _vdp_DRI2QueryExtension@Base 0.4
  _vdp_DRI2QueryVersion@Base 0.4
+ _vdp_DRI2RemoveExtension@Base 0.4.1-8~
  init_config@Base 0.4.1-6~
  init_fixes@Base 0.4.1-6~
  vdp_device_create_x11@Base 0.2
diff -Nru libvdpau-0.4.1/debian/patches/0003-Fix-leaked-extension-info-on-library-unload.patch libvdpau-0.4.1/debian/patches/0003-Fix-leaked-extension-info-on-library-unload.patch
--- libvdpau-0.4.1/debian/patches/0003-Fix-leaked-extension-info-on-library-unload.patch	1970-01-01 01:00:00.000000000 +0100
+++ libvdpau-0.4.1/debian/patches/0003-Fix-leaked-extension-info-on-library-unload.patch	2013-01-27 01:49:31.000000000 +0100
@@ -0,0 +1,113 @@
+From 3b43955c7324e1d213a3134387767722f34e2356 Mon Sep 17 00:00:00 2001
+From: Robert Morell <rmorell@nvidia.com>
+Date: Tue, 22 Jan 2013 13:26:56 -0800
+Subject: [PATCH 3/3] Fix leaked extension info on library unload
+
+In this sequence:
+dlopen(libvdpau.so)
+vdp_device_create_x11(dpy, ...)
+dlclose(libvdpau.so)
+XCloseDisplay(dpy)
+
+the process will attempt to call the address at which DRI2CloseDisplay
+was previously mapped, possibly resulting in a SEGV.
+
+Instead of tracking displays to which we've added hooks and cleaning up
+the extension on library unload or display close, simply clean up after
+ourselves once we have the data we need.
+
+Signed-off-by: Robert Morell <rmorell@nvidia.com>
+Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
+Tested-by: Aaron Plattner <aplattner@nvidia.com>
+Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
+---
+ src/mesa_dri2.c     |   19 +++++++++++++++++--
+ src/mesa_dri2.h     |    3 +++
+ src/vdpau_wrapper.c |    3 +++
+ 3 files changed, 23 insertions(+), 2 deletions(-)
+
+diff --git a/src/mesa_dri2.c b/src/mesa_dri2.c
+index dbf9aa8..3bc75ef 100644
+--- a/src/mesa_dri2.c
++++ b/src/mesa_dri2.c
+@@ -42,7 +42,6 @@
+ 
+ static char dri2ExtensionName[] = DRI2_NAME;
+ static XExtensionInfo *dri2Info;
+-static XEXT_GENERATE_CLOSE_DISPLAY (DRI2CloseDisplay, dri2Info)
+ 
+ static /* const */ XExtensionHooks dri2ExtensionHooks = {
+   NULL,                   /* create_gc */
+@@ -51,7 +50,7 @@ static /* const */ XExtensionHooks dri2ExtensionHooks = {
+   NULL,                   /* free_gc */
+   NULL,                   /* create_font */
+   NULL,                   /* free_font */
+-  DRI2CloseDisplay,       /* close_display */
++  NULL,                   /* close_display */
+   NULL,                   /* wire_to_event */
+   NULL,                   /* event_to_wire */
+   NULL,                   /* error */
+@@ -75,6 +74,14 @@ _vdp_DRI2QueryExtension(Display * dpy, int *eventBase, int *errorBase)
+       return True;
+    }
+ 
++   if (dri2Info) {
++      if (info) {
++         XextRemoveDisplay(dri2Info, dpy);
++      }
++      XextDestroyExtension(dri2Info);
++      dri2Info = NULL;
++   }
++
+    return False;
+ }
+ 
+@@ -161,3 +168,11 @@ _vdp_DRI2Connect(Display * dpy, XID window, char **driverName, char **deviceName
+ 
+    return True;
+ }
++
++void
++_vdp_DRI2RemoveExtension(Display * dpy)
++{
++   XextRemoveDisplay(dri2Info, dpy);
++   XextDestroyExtension(dri2Info);
++   dri2Info = NULL;
++}
+diff --git a/src/mesa_dri2.h b/src/mesa_dri2.h
+index 5c5fb12..09bde8c 100644
+--- a/src/mesa_dri2.h
++++ b/src/mesa_dri2.h
+@@ -47,4 +47,7 @@ extern Bool
+ _vdp_DRI2Connect(Display * display, XID window, char **driverName,
+                  char **deviceName);
+ 
++extern void
++_vdp_DRI2RemoveExtension(Display * display);
++
+ #endif
+diff --git a/src/vdpau_wrapper.c b/src/vdpau_wrapper.c
+index a1d5d40..d847a87 100644
+--- a/src/vdpau_wrapper.c
++++ b/src/vdpau_wrapper.c
+@@ -86,14 +86,17 @@ static char * _vdp_get_driver_name_from_dri2(
+ 
+     if (!_vdp_DRI2QueryVersion(display, &major, &minor) ||
+             (major < 1 || (major == 1 && minor < 2))) {
++        _vdp_DRI2RemoveExtension(display);
+         return NULL;
+     }
+ 
+     if (!_vdp_DRI2Connect(display, root, &driver_name, &device_name)) {
++        _vdp_DRI2RemoveExtension(display);
+         return NULL;
+     }
+ 
+     XFree(device_name);
++    _vdp_DRI2RemoveExtension(display);
+ #endif /* DRI2 */
+     return driver_name;
+ }
+-- 
+1.7.10.4
+
diff -Nru libvdpau-0.4.1/debian/patches/series libvdpau-0.4.1/debian/patches/series
--- libvdpau-0.4.1/debian/patches/series	2012-08-16 02:21:22.000000000 +0200
+++ libvdpau-0.4.1/debian/patches/series	2013-01-27 01:49:31.000000000 +0100
@@ -1,3 +1,5 @@
+0003-Fix-leaked-extension-info-on-library-unload.patch
+
 track_dynamic_library_handles_and_free_them_on_exit.patch
 link-with-libx11.patch
 simplify-dlopen-path-length-error-handling.patch

Reply to: