]>
Commit | Line | Data |
---|---|---|
0f2e926c AM |
1 | http://sourceware.org/ml/libc-alpha/2012-01/msg00002.html |
2 | ||
3 | The following patch: | |
4 | Has been reported as causing numerous problems in Fedora & Debian. I | |
5 | don't think anyone has done any serious analysis of the issue, but the | |
6 | patch has been pulled from both distributions because of the | |
7 | instability it's introduced. | |
8 | ||
9 | https://bugzilla.redhat.com/show_bug.cgi?id=769421 | |
10 | http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=651899 | |
11 | ||
12 | ||
13 | commit c5a0802a682dba23f92d47f0f99775aebfbe2539 | |
14 | Author: Andreas Schwab <schwab@redhat.com> | |
15 | Date: Mon Nov 28 13:38:19 2011 +0100 | |
16 | ||
17 | Handle EAGAIN from FUTEX_WAIT_REQUEUE_PI | |
18 | ||
19 | 2011-11-28 Andreas Schwab <schwab@redhat.com> | |
20 | ||
21 | * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S: Handle | |
22 | EAGAIN from FUTEX_WAIT_REQUEUE_PI. | |
23 | * sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S: Likewise. | |
24 | ||
25 | diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S | |
583469ac | 26 | index 54590b7..53970d7 100644 |
0f2e926c AM |
27 | --- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S |
28 | +++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S | |
583469ac AM |
29 | @@ -134,7 +134,6 @@ __pthread_cond_wait: |
30 | cmpl $PI_BIT, %eax | |
31 | jne 18f | |
32 | ||
33 | -90: | |
34 | movl $(FUTEX_WAIT_REQUEUE_PI|FUTEX_PRIVATE_FLAG), %ecx | |
35 | movl %ebp, %edx | |
36 | xorl %esi, %esi | |
37 | @@ -148,9 +147,6 @@ __pthread_cond_wait: | |
38 | sete 16(%esp) | |
39 | je 19f | |
40 | ||
41 | - cmpl $-EAGAIN, %eax | |
42 | - je 91f | |
43 | - | |
44 | /* Normal and PI futexes dont mix. Use normal futex functions only | |
45 | if the kernel does not support the PI futex functions. */ | |
46 | cmpl $-ENOSYS, %eax | |
47 | @@ -395,78 +391,6 @@ __pthread_cond_wait: | |
48 | #endif | |
49 | call __lll_unlock_wake | |
50 | jmp 11b | |
51 | - | |
52 | -91: | |
53 | -.LcleanupSTART2: | |
54 | - /* FUTEX_WAIT_REQUEUE_PI returned EAGAIN. We need to | |
55 | - call it again. */ | |
56 | - | |
57 | - /* Get internal lock. */ | |
58 | - movl $1, %edx | |
59 | - xorl %eax, %eax | |
60 | - LOCK | |
61 | -#if cond_lock == 0 | |
62 | - cmpxchgl %edx, (%ebx) | |
63 | -#else | |
64 | - cmpxchgl %edx, cond_lock(%ebx) | |
65 | -#endif | |
66 | - jz 92f | |
67 | - | |
68 | -#if cond_lock == 0 | |
69 | - movl %ebx, %edx | |
70 | -#else | |
71 | - leal cond_lock(%ebx), %edx | |
72 | -#endif | |
73 | -#if (LLL_SHARED-LLL_PRIVATE) > 255 | |
74 | - xorl %ecx, %ecx | |
75 | -#endif | |
76 | - cmpl $-1, dep_mutex(%ebx) | |
77 | - setne %cl | |
78 | - subl $1, %ecx | |
79 | - andl $(LLL_SHARED-LLL_PRIVATE), %ecx | |
80 | -#if LLL_PRIVATE != 0 | |
81 | - addl $LLL_PRIVATE, %ecx | |
82 | -#endif | |
83 | - call __lll_lock_wait | |
84 | - | |
85 | -92: | |
86 | - /* Increment the cond_futex value again, so it can be used as a new | |
87 | - expected value. */ | |
88 | - addl $1, cond_futex(%ebx) | |
89 | - movl cond_futex(%ebx), %ebp | |
90 | - | |
91 | - /* Unlock. */ | |
92 | - LOCK | |
93 | -#if cond_lock == 0 | |
94 | - subl $1, (%ebx) | |
95 | -#else | |
96 | - subl $1, cond_lock(%ebx) | |
97 | -#endif | |
98 | - je 93f | |
99 | -#if cond_lock == 0 | |
100 | - movl %ebx, %eax | |
101 | -#else | |
102 | - leal cond_lock(%ebx), %eax | |
103 | -#endif | |
104 | -#if (LLL_SHARED-LLL_PRIVATE) > 255 | |
105 | - xorl %ecx, %ecx | |
106 | -#endif | |
107 | - cmpl $-1, dep_mutex(%ebx) | |
108 | - setne %cl | |
109 | - subl $1, %ecx | |
110 | - andl $(LLL_SHARED-LLL_PRIVATE), %ecx | |
111 | -#if LLL_PRIVATE != 0 | |
112 | - addl $LLL_PRIVATE, %ecx | |
113 | -#endif | |
114 | - call __lll_unlock_wake | |
115 | - | |
116 | -93: | |
117 | - /* Set the rest of SYS_futex args for FUTEX_WAIT_REQUEUE_PI. */ | |
118 | - xorl %ecx, %ecx | |
119 | - movl dep_mutex(%ebx), %edi | |
120 | - jmp 90b | |
121 | -.LcleanupEND2: | |
122 | - | |
123 | .size __pthread_cond_wait, .-__pthread_cond_wait | |
124 | versioned_symbol (libpthread, __pthread_cond_wait, pthread_cond_wait, | |
125 | GLIBC_2_3_2) | |
126 | @@ -639,10 +563,6 @@ __condvar_w_cleanup: | |
127 | .long .LcleanupEND-.Lsub_cond_futex | |
128 | .long __condvar_w_cleanup-.LSTARTCODE | |
129 | .uleb128 0 | |
130 | - .long .LcleanupSTART2-.LSTARTCODE | |
131 | - .long .LcleanupEND2-.LcleanupSTART2 | |
132 | - .long __condvar_w_cleanup-.LSTARTCODE | |
133 | - .uleb128 0 | |
134 | .long .LcallUR-.LSTARTCODE | |
135 | .long .LENDCODE-.LcallUR | |
136 | .long 0 | |
0f2e926c | 137 | diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S |
583469ac | 138 | index d837d15..7535baa 100644 |
0f2e926c AM |
139 | --- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S |
140 | +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S | |
583469ac AM |
141 | @@ -23,7 +23,6 @@ |
142 | #include <lowlevelcond.h> | |
143 | #include <tcb-offsets.h> | |
144 | #include <pthread-pi-defines.h> | |
145 | -#include <pthread-errnos.h> | |
0f2e926c | 146 | #include <stap-probe.h> |
583469ac AM |
147 | |
148 | #include <kernel-features.h> | |
583469ac AM |
149 | @@ -134,14 +133,11 @@ __pthread_cond_wait: |
150 | cmpl $PI_BIT, %eax | |
151 | jne 61f | |
152 | ||
153 | -90: | |
154 | movl $(FUTEX_WAIT_REQUEUE_PI|FUTEX_PRIVATE_FLAG), %esi | |
155 | movl $SYS_futex, %eax | |
156 | syscall | |
157 | ||
158 | movl $1, %r8d | |
159 | - cmpq $-EAGAIN, %rax | |
160 | - je 91f | |
161 | #ifdef __ASSUME_REQUEUE_PI | |
162 | jmp 62f | |
163 | #else | |
164 | @@ -328,70 +324,6 @@ __pthread_cond_wait: | |
165 | ||
166 | 13: movq %r10, %rax | |
167 | jmp 14b | |
168 | - | |
169 | -91: | |
170 | -.LcleanupSTART2: | |
171 | - /* FUTEX_WAIT_REQUEUE_PI returned EAGAIN. We need to | |
172 | - call it again. */ | |
173 | - movq 8(%rsp), %rdi | |
174 | - | |
175 | - /* Get internal lock. */ | |
176 | - movl $1, %esi | |
177 | - xorl %eax, %eax | |
178 | - LOCK | |
179 | -#if cond_lock == 0 | |
180 | - cmpxchgl %esi, (%rdi) | |
181 | -#else | |
182 | - cmpxchgl %esi, cond_lock(%rdi) | |
183 | -#endif | |
184 | - jz 92f | |
185 | - | |
186 | -#if cond_lock != 0 | |
187 | - addq $cond_lock, %rdi | |
188 | -#endif | |
0f2e926c | 189 | - LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi) |
583469ac AM |
190 | - movl $LLL_PRIVATE, %eax |
191 | - movl $LLL_SHARED, %esi | |
192 | - cmovne %eax, %esi | |
193 | - callq __lll_lock_wait | |
194 | -#if cond_lock != 0 | |
195 | - subq $cond_lock, %rdi | |
196 | -#endif | |
197 | -92: | |
198 | - /* Increment the cond_futex value again, so it can be used as a new | |
199 | - expected value. */ | |
200 | - incl cond_futex(%rdi) | |
201 | - movl cond_futex(%rdi), %edx | |
202 | - | |
203 | - /* Release internal lock. */ | |
204 | - LOCK | |
205 | -#if cond_lock == 0 | |
206 | - decl (%rdi) | |
207 | -#else | |
208 | - decl cond_lock(%rdi) | |
209 | -#endif | |
210 | - jz 93f | |
211 | - | |
212 | -#if cond_lock != 0 | |
213 | - addq $cond_lock, %rdi | |
214 | -#endif | |
0f2e926c | 215 | - LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi) |
583469ac AM |
216 | - movl $LLL_PRIVATE, %eax |
217 | - movl $LLL_SHARED, %esi | |
218 | - cmovne %eax, %esi | |
219 | - /* The call preserves %rdx. */ | |
220 | - callq __lll_unlock_wake | |
221 | -#if cond_lock != 0 | |
222 | - subq $cond_lock, %rdi | |
223 | -#endif | |
224 | -93: | |
225 | - /* Set the rest of SYS_futex args for FUTEX_WAIT_REQUEUE_PI. */ | |
226 | - xorq %r10, %r10 | |
0f2e926c | 227 | - mov dep_mutex(%rdi), %R8_LP |
583469ac AM |
228 | - leaq cond_futex(%rdi), %rdi |
229 | - jmp 90b | |
230 | -.LcleanupEND2: | |
231 | - | |
232 | .size __pthread_cond_wait, .-__pthread_cond_wait | |
233 | versioned_symbol (libpthread, __pthread_cond_wait, pthread_cond_wait, | |
234 | GLIBC_2_3_2) | |
235 | @@ -544,15 +476,11 @@ __condvar_cleanup1: | |
236 | .uleb128 .LcleanupSTART-.LSTARTCODE | |
237 | .uleb128 .LcleanupEND-.LcleanupSTART | |
238 | .uleb128 __condvar_cleanup1-.LSTARTCODE | |
239 | - .uleb128 0 | |
240 | - .uleb128 .LcleanupSTART2-.LSTARTCODE | |
241 | - .uleb128 .LcleanupEND2-.LcleanupSTART2 | |
242 | - .uleb128 __condvar_cleanup1-.LSTARTCODE | |
243 | - .uleb128 0 | |
244 | + .uleb128 0 | |
245 | .uleb128 .LcallUR-.LSTARTCODE | |
246 | .uleb128 .LENDCODE-.LcallUR | |
247 | .uleb128 0 | |
248 | - .uleb128 0 | |
249 | + .uleb128 0 | |
250 | .Lcstend: | |
251 | ||
252 |