Просмотр исходного кода

PIC fixes for hardened

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Natanael Copa <natanael.copa@gmail.com>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
Timo Teräs 15 лет назад
Родитель
Сommit
5418ef694e

+ 2 - 2
libpthread/nptl/sysdeps/pthread/Makefile.in

@@ -23,8 +23,8 @@ libpthread_CSRC = pthread_barrier_wait.c pthread_cond_broadcast.c	\
 
 ifeq ($(TARGET_ARCH),i386)
 X86_PTHREAD_EXCLUDE_LIST = pthread_spin_unlock.c pthread_spin_init.c \
-		pthread_cond_wait.c pthread_barrier_wait.c pthread_cond_broadcast.c	\
-		pthread_cond_signal.c pthread_cond_timedwait.c pthread_rwlock_timedrdlock.c	\
+		pthread_barrier_wait.c pthread_cond_broadcast.c	\
+		pthread_cond_signal.c pthread_rwlock_timedrdlock.c	\
 		pthread_rwlock_timedwrlock.c pthread_rwlock_unlock.c pthread_rwlock_wrlock.c \
 		pthread_rwlock_rdlock.c
 

+ 4 - 3
libpthread/nptl/sysdeps/unix/sysv/linux/i386/Makefile.arch

@@ -15,9 +15,10 @@ libc_a_CSRC = fork.c
 libc_a_SSRC = clone.S vfork.S
 
 libpthread_SSRC += i486/lowlevellock.S i486/pthread_barrier_wait.S i486/pthread_cond_signal.S i486/pthread_cond_broadcast.S \
-				   i486/pthread_cond_timedwait.S i486/pthread_cond_wait.S i486/sem_post.S i486/sem_timedwait.S \
-				   i486/sem_trywait.S i486/sem_wait.S i486/pthread_rwlock_rdlock.S i486/pthread_rwlock_wrlock.S \
-				   i486/pthread_rwlock_timedrdlock.S i486/pthread_rwlock_timedwrlock.S i486/pthread_rwlock_unlock.S
+		   i486/sem_post.S i486/sem_timedwait.S \
+		   i486/sem_trywait.S i486/sem_wait.S i486/pthread_rwlock_rdlock.S i486/pthread_rwlock_wrlock.S \
+		   i486/pthread_rwlock_timedrdlock.S i486/pthread_rwlock_timedwrlock.S i486/pthread_rwlock_unlock.S
+#i486/pthread_cond_timedwait.S i486/pthread_cond_wait.S
 
 libc_a_SSRC += i486/libc-lowlevellock.S
 

+ 4 - 2
libpthread/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h

@@ -65,8 +65,10 @@ typedef int lll_lock_t;
 /* Delay in spinlock loop.  */
 #define BUSY_WAIT_NOP          __asm__ ("rep; nop")
 
-
 #define lll_futex_wait(futex, val) \
+  lll_futex_timed_wait (futex, val, NULL)
+
+#define lll_futex_timed_wait(futex, val, timeout) \
   ({									      \
     int __ret;							      \
     register __typeof (val) _val __asm__ ("edx") = (val);		      \
@@ -74,7 +76,7 @@ typedef int lll_lock_t;
 		      LLL_ENTER_KERNEL					      \
 		      LLL_EBX_LOAD					      \
 		      : "=a" (__ret)					      \
-		      : "0" (SYS_futex), LLL_EBX_REG (futex), "S" (0),	      \
+		      : "0" (SYS_futex), LLL_EBX_REG (futex), "S" (timeout),  \
 			"c" (FUTEX_WAIT), "d" (_val),			      \
 			"i" (offsetof (tcbhead_t, sysinfo)));		      \
    __ret; })