File pthread-cond-wait-stack-align.patch of Package glibc.34926
Index: glibc-2.22/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
===================================================================
--- glibc-2.22.orig/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
+++ glibc-2.22/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
@@ -44,6 +44,9 @@ __pthread_cond_timedwait:
cfi_lsda(DW_EH_PE_udata4, .LexceptSTART)
#endif
+ subl $4,%esp
+ cfi_adjust_cfa_offset(4)
+
pushl %ebp
cfi_adjust_cfa_offset(4)
cfi_rel_offset(%ebp, 0)
@@ -57,10 +60,10 @@ __pthread_cond_timedwait:
cfi_adjust_cfa_offset(4)
cfi_rel_offset(%ebx, 0)
- movl 20(%esp), %ebx
- movl 28(%esp), %ebp
+ movl 24(%esp), %ebx
+ movl 32(%esp), %ebp
- LIBC_PROBE (cond_timedwait, 3, %ebx, 24(%esp), %ebp)
+ LIBC_PROBE (cond_timedwait, 3, %ebx, 28(%esp), %ebp)
cmpl $1000000000, 4(%ebp)
movl $EINVAL, %eax
@@ -108,7 +111,7 @@ __pthread_cond_timedwait:
/* Store the reference to the mutex. If there is already a
different value in there this is a bad user bug. */
2: cmpl $-1, dep_mutex(%ebx)
- movl 24(%esp), %eax
+ movl 28(%esp), %eax
je 17f
movl %eax, dep_mutex(%ebx)
@@ -245,7 +248,7 @@ __pthread_cond_timedwait:
ENTER_KERNEL
subl $cond_futex, %ebx
.Lsub_cond_futex:
- movl 28+FRAME_SIZE(%esp), %ebp
+ movl 32+FRAME_SIZE(%esp), %ebp
movl %eax, %esi
41: movl (%esp), %eax
@@ -351,7 +354,7 @@ __pthread_cond_timedwait:
#endif
jne 10f
-11: movl 24+FRAME_SIZE(%esp), %eax
+11: movl 28+FRAME_SIZE(%esp), %eax
/* With requeue_pi, the mutex lock is held in the kernel. */
movl 16(%esp), %ecx
testl %ecx, %ecx
@@ -384,6 +387,9 @@ __pthread_cond_timedwait:
cfi_adjust_cfa_offset(-4)
cfi_restore(%ebp)
+ addl $4,%esp
+ cfi_adjust_cfa_offset(-4)
+
ret
cfi_restore_state
@@ -523,7 +529,7 @@ __pthread_cond_timedwait:
/* Store the reference to the mutex. If there is already a
different value in there this is a bad user bug. */
102: cmpl $-1, dep_mutex(%ebx)
- movl 24(%esp), %eax
+ movl 28(%esp), %eax
je 117f
movl %eax, dep_mutex(%ebx)
@@ -887,7 +893,7 @@ __condvar_tw_cleanup:
in case of PI mutexes, if we got cancelled after a successful
return of the futex syscall and before disabling async
cancellation. */
-5: movl 24+FRAME_SIZE(%esp), %eax
+5: movl 28+FRAME_SIZE(%esp), %eax
movl MUTEX_KIND(%eax), %ebx
andl $(ROBUST_BIT|PI_BIT), %ebx
cmpl $PI_BIT, %ebx
Index: glibc-2.22/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
===================================================================
--- glibc-2.22.orig/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
+++ glibc-2.22/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
@@ -45,6 +45,9 @@ __pthread_cond_wait:
cfi_lsda(DW_EH_PE_udata4, .LexceptSTART)
#endif
+ subl $4,%esp
+ cfi_adjust_cfa_offset(4)
+
pushl %ebp
cfi_adjust_cfa_offset(4)
cfi_rel_offset(%ebp, 0)
@@ -59,9 +62,9 @@ __pthread_cond_wait:
cfi_rel_offset(%ebx, 0)
xorl %esi, %esi
- movl 20(%esp), %ebx
+ movl 24(%esp), %ebx
- LIBC_PROBE (cond_wait, 2, 24(%esp), %ebx)
+ LIBC_PROBE (cond_wait, 2, 28(%esp), %ebx)
/* Get internal lock. */
movl $1, %edx
@@ -77,7 +80,7 @@ __pthread_cond_wait:
/* Store the reference to the mutex. If there is already a
different value in there this is a bad user bug. */
2: cmpl $-1, dep_mutex(%ebx)
- movl 24(%esp), %eax
+ movl 28(%esp), %eax
je 15f
movl %eax, dep_mutex(%ebx)
@@ -265,7 +268,7 @@ __pthread_cond_wait:
jne 10f
/* With requeue_pi, the mutex lock is held in the kernel. */
-11: movl 24+FRAME_SIZE(%esp), %eax
+11: movl 28+FRAME_SIZE(%esp), %eax
movl 16(%esp), %ecx
testl %ecx, %ecx
jnz 21f
@@ -287,6 +290,9 @@ __pthread_cond_wait:
cfi_adjust_cfa_offset(-4)
cfi_restore(%ebp)
+ addl $4,%esp
+ cfi_adjust_cfa_offset(-4)
+
/* We return the result of the mutex_lock operation. */
ret
@@ -570,7 +576,7 @@ __condvar_w_cleanup:
in case of PI mutexes, if we got cancelled after a successful
return of the futex syscall and before disabling async
cancellation. */
-5: movl 24+FRAME_SIZE(%esp), %eax
+5: movl 28+FRAME_SIZE(%esp), %eax
movl MUTEX_KIND(%eax), %ebx
andl $(ROBUST_BIT|PI_BIT), %ebx
cmpl $PI_BIT, %ebx