1 |
ssuominen 13/05/02 01:16:58 |
2 |
|
3 |
Modified: 1.0.25-extraneous-cflags.diff |
4 |
Added: alsa-lib-1.0.27-dlclose.patch |
5 |
Log: |
6 |
Upstream patch for "Fix doubly call of dlclose() in dlobj caching code" as noted by galtgendo at Freenode |
7 |
|
8 |
(Portage version: 2.2.0_alpha173/cvs/Linux x86_64, signed Manifest commit with key 4868F14D) |
9 |
|
10 |
Revision Changes Path |
11 |
1.2 media-libs/alsa-lib/files/1.0.25-extraneous-cflags.diff |
12 |
|
13 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-libs/alsa-lib/files/1.0.25-extraneous-cflags.diff?rev=1.2&view=markup |
14 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-libs/alsa-lib/files/1.0.25-extraneous-cflags.diff?rev=1.2&content-type=text/plain |
15 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-libs/alsa-lib/files/1.0.25-extraneous-cflags.diff?r1=1.1&r2=1.2 |
16 |
|
17 |
Index: 1.0.25-extraneous-cflags.diff |
18 |
=================================================================== |
19 |
RCS file: /var/cvsroot/gentoo-x86/media-libs/alsa-lib/files/1.0.25-extraneous-cflags.diff,v |
20 |
retrieving revision 1.1 |
21 |
retrieving revision 1.2 |
22 |
diff -u -r1.1 -r1.2 |
23 |
--- 1.0.25-extraneous-cflags.diff 26 Jan 2012 11:49:30 -0000 1.1 |
24 |
+++ 1.0.25-extraneous-cflags.diff 2 May 2013 01:16:58 -0000 1.2 |
25 |
@@ -1,6 +1,5 @@ |
26 |
-diff -uNr alsa-lib-1.0.25.ORIG/modules/mixer/simple/Makefile.am alsa-lib-1.0.25/modules/mixer/simple/Makefile.am |
27 |
---- alsa-lib-1.0.25.ORIG/modules/mixer/simple/Makefile.am 2012-01-26 10:46:50.870738448 +0000 |
28 |
-+++ alsa-lib-1.0.25/modules/mixer/simple/Makefile.am 2012-01-26 11:12:16.972695934 +0000 |
29 |
+--- modules/mixer/simple/Makefile.am |
30 |
++++ modules/mixer/simple/Makefile.am |
31 |
@@ -1,7 +1,7 @@ |
32 |
alsaplugindir = @ALSA_PLUGIN_DIR@ |
33 |
pkglibdir = $(alsaplugindir)/smixer |
34 |
@@ -10,9 +9,8 @@ |
35 |
|
36 |
INCLUDES=-I$(top_srcdir)/include |
37 |
|
38 |
-diff -uNr alsa-lib-1.0.25.ORIG/src/pcm/scopes/Makefile.am alsa-lib-1.0.25/src/pcm/scopes/Makefile.am |
39 |
---- alsa-lib-1.0.25.ORIG/src/pcm/scopes/Makefile.am 2012-01-26 10:46:50.875738335 +0000 |
40 |
-+++ alsa-lib-1.0.25/src/pcm/scopes/Makefile.am 2012-01-26 11:12:29.172695655 +0000 |
41 |
+--- src/pcm/scopes/Makefile.am |
42 |
++++ src/pcm/scopes/Makefile.am |
43 |
@@ -1,6 +1,6 @@ |
44 |
pkglibdir = $(libdir)/@PACKAGE@/scopes |
45 |
|
46 |
|
47 |
|
48 |
|
49 |
1.1 media-libs/alsa-lib/files/alsa-lib-1.0.27-dlclose.patch |
50 |
|
51 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-libs/alsa-lib/files/alsa-lib-1.0.27-dlclose.patch?rev=1.1&view=markup |
52 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-libs/alsa-lib/files/alsa-lib-1.0.27-dlclose.patch?rev=1.1&content-type=text/plain |
53 |
|
54 |
Index: alsa-lib-1.0.27-dlclose.patch |
55 |
=================================================================== |
56 |
From e1e40c25535af35fa5cdf7ffc95a01fbff098ddd Mon Sep 17 00:00:00 2001 |
57 |
From: Takashi Iwai <tiwai@××××.de> |
58 |
Date: Mon, 15 Apr 2013 18:12:17 +0200 |
59 |
Subject: [PATCH] Fix doubly call of dlclose() in dlobj caching code |
60 |
|
61 |
When multiple dlobj_cache items point to the same dlobj, dlclose() may |
62 |
be called wrongly multiple times when these items are cleared, because |
63 |
we manage the dlobj_cache list as a flat list. This results in a bad |
64 |
segfault we've seen in openal-soft, for example. |
65 |
|
66 |
For fixing this, we need the refcounting of dlobj itself. But, in |
67 |
this case, we don't have to manage yet another list, since dlopen() |
68 |
does a proper refcounting by itself. That is, we can just call always |
69 |
dlopen() at each time a new function is assigned, and also call |
70 |
dlclose() for each released dlobj_cache item at cleanup. |
71 |
|
72 |
Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=814250 |
73 |
|
74 |
Signed-off-by: Takashi Iwai <tiwai@××××.de> |
75 |
--- |
76 |
src/dlmisc.c | 31 +++++++++++-------------------- |
77 |
1 file changed, 11 insertions(+), 20 deletions(-) |
78 |
|
79 |
diff --git a/src/dlmisc.c b/src/dlmisc.c |
80 |
index 3788382..2de0234 100644 |
81 |
--- a/src/dlmisc.c |
82 |
+++ b/src/dlmisc.c |
83 |
@@ -208,8 +208,7 @@ void *snd_dlobj_cache_get(const char *lib, const char *name, |
84 |
{ |
85 |
struct list_head *p; |
86 |
struct dlobj_cache *c; |
87 |
- void *func, *dlobj = NULL; |
88 |
- int dlobj_close = 0; |
89 |
+ void *func, *dlobj; |
90 |
|
91 |
snd_dlobj_lock(); |
92 |
list_for_each(p, &pcm_dlobj_list) { |
93 |
@@ -220,7 +219,6 @@ void *snd_dlobj_cache_get(const char *lib, const char *name, |
94 |
continue; |
95 |
if (!lib && c->lib) |
96 |
continue; |
97 |
- dlobj = c->dlobj; |
98 |
if (strcmp(c->name, name) == 0) { |
99 |
c->refcnt++; |
100 |
func = c->func; |
101 |
@@ -228,17 +226,16 @@ void *snd_dlobj_cache_get(const char *lib, const char *name, |
102 |
return func; |
103 |
} |
104 |
} |
105 |
+ |
106 |
+ dlobj = snd_dlopen(lib, RTLD_NOW); |
107 |
if (dlobj == NULL) { |
108 |
- dlobj = snd_dlopen(lib, RTLD_NOW); |
109 |
- if (dlobj == NULL) { |
110 |
- if (verbose) |
111 |
- SNDERR("Cannot open shared library %s", |
112 |
+ if (verbose) |
113 |
+ SNDERR("Cannot open shared library %s", |
114 |
lib ? lib : "[builtin]"); |
115 |
- snd_dlobj_unlock(); |
116 |
- return NULL; |
117 |
- } |
118 |
- dlobj_close = 1; |
119 |
+ snd_dlobj_unlock(); |
120 |
+ return NULL; |
121 |
} |
122 |
+ |
123 |
func = snd_dlsym(dlobj, name, version); |
124 |
if (func == NULL) { |
125 |
if (verbose) |
126 |
@@ -257,8 +254,7 @@ void *snd_dlobj_cache_get(const char *lib, const char *name, |
127 |
free((void *)c->lib); |
128 |
free(c); |
129 |
__err: |
130 |
- if (dlobj_close) |
131 |
- snd_dlclose(dlobj); |
132 |
+ snd_dlclose(dlobj); |
133 |
snd_dlobj_unlock(); |
134 |
return NULL; |
135 |
} |
136 |
@@ -298,16 +294,11 @@ void snd_dlobj_cache_cleanup(void) |
137 |
struct list_head *p, *npos; |
138 |
struct dlobj_cache *c; |
139 |
|
140 |
- /* clean up caches only when really no user is present */ |
141 |
snd_dlobj_lock(); |
142 |
- list_for_each(p, &pcm_dlobj_list) { |
143 |
- c = list_entry(p, struct dlobj_cache, list); |
144 |
- if (c->refcnt) |
145 |
- goto unlock; |
146 |
- } |
147 |
- |
148 |
list_for_each_safe(p, npos, &pcm_dlobj_list) { |
149 |
c = list_entry(p, struct dlobj_cache, list); |
150 |
+ if (c->refcnt) |
151 |
+ continue; |
152 |
list_del(p); |
153 |
snd_dlclose(c->dlobj); |
154 |
free((void *)c->name); /* shut up gcc warning */ |
155 |
-- |
156 |
1.7.11.7 |