about summary refs log tree commit diff
path: root/nptl/sysdeps
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-06-18 04:29:42 +0000
committerUlrich Drepper <drepper@redhat.com>2004-06-18 04:29:42 +0000
commit7c3164bc6650ceeecd67841dfb8fcf399d12a93f (patch)
tree23a7016e21d2848ec2d3fdfa1b8dc1abcf3e85d4 /nptl/sysdeps
parent72e615009bfde798692487d04ae548d15eb423ba (diff)
downloadglibc-7c3164bc6650ceeecd67841dfb8fcf399d12a93f.tar.gz
glibc-7c3164bc6650ceeecd67841dfb8fcf399d12a93f.tar.xz
glibc-7c3164bc6650ceeecd67841dfb8fcf399d12a93f.zip
Update.
2004-06-17  Ulrich Drepper  <drepper@redhat.com>

	* sysdeps/pthread/pthread_cond_timedwait.c
	(__pthread_cond_timedwait): Also check for negativ nanoseconds.
	* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
	(__pthread_cond_timedwait): Check for invalid nanosecond in
	timeout value.
	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S: Likewise.
	* tst-cond19.c: New file.
	* Makefile: Add rules to build and run tst-cond19.
Diffstat (limited to 'nptl/sysdeps')
-rw-r--r--nptl/sysdeps/pthread/pthread_cond_timedwait.c2
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S4
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S5
3 files changed, 10 insertions, 1 deletions
diff --git a/nptl/sysdeps/pthread/pthread_cond_timedwait.c b/nptl/sysdeps/pthread/pthread_cond_timedwait.c
index 940b51b4be..7de2b2936f 100644
--- a/nptl/sysdeps/pthread/pthread_cond_timedwait.c
+++ b/nptl/sysdeps/pthread/pthread_cond_timedwait.c
@@ -50,7 +50,7 @@ __pthread_cond_timedwait (cond, mutex, abstime)
   int result = 0;
 
   /* Catch invalid parameters.  */
-  if (abstime->tv_nsec >= 1000000000)
+  if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)
     return EINVAL;
 
   /* Make sure we are along.  */
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
index 305fa4d5d7..1d24b1a1e1 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
@@ -55,6 +55,10 @@ __pthread_cond_timedwait:
 	movl	20(%esp), %ebx
 	movl	28(%esp), %ebp
 
+	cmpl	$1000000000, 4(%ebp)
+	movl	$EINVAL, %eax
+	jae	18f
+
 	/* Get internal lock.  */
 	movl	$1, %edx
 	xorl	%eax, %eax
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
index e75f05e07f..5c6a471096 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
@@ -54,6 +54,11 @@ __pthread_cond_timedwait:
 #define FRAME_SIZE 80
 	subq	$FRAME_SIZE, %rsp
 .Lsubq:
+
+	cmpq	$1000000000, 8(%rdx)
+	movl	$EINVAL, %rax
+	jae	18f
+
 	/* Stack frame:
 
 	   rsp + 80