about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-09-07 00:07:08 -0400
committerUlrich Drepper <drepper@gmail.com>2011-09-07 00:07:08 -0400
commite38ba7ab6a56d53bde4fcff250f6928fb473bc3c (patch)
tree039a4eceb3e6f4171a42c2b18eb8bde24b53e564
parentfc8bffcccf5821bca179486abef83a7f82526715 (diff)
downloadglibc-e38ba7ab6a56d53bde4fcff250f6928fb473bc3c.tar.gz
glibc-e38ba7ab6a56d53bde4fcff250f6928fb473bc3c.tar.xz
glibc-e38ba7ab6a56d53bde4fcff250f6928fb473bc3c.zip
Make sure __vdso_clock_gettime always contains a valid pointer
-rw-r--r--ChangeLog8
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/init-first.c7
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/syscalls.list1
3 files changed, 16 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index db4150e3d9..3011a5abc3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-09-07  Ulrich Drepper  <drepper@gmail.com>
+
+	* sysdeps/unix/sysv/linux/x86_64/init-first.c
+	(_libc_vdso_platform_setup): If vDSO is not present store pointer to
+	syscall wrapper around clock_gettime in __vdso_clock_gettime.
+	* sysdeps/unix/sysv/linux/x86_64/syscalls.list: Add entry for
+	clock_gettime.
+
 2011-09-06  Ulrich Drepper  <drepper@gmail.com>
 
 	* sysdeps/unix/sysv/linux/x86_64/clock_gettime.c (INTERNAL_GETTIME):
diff --git a/sysdeps/unix/sysv/linux/x86_64/init-first.c b/sysdeps/unix/sysv/linux/x86_64/init-first.c
index 25cf08bd77..cb39acae13 100644
--- a/sysdeps/unix/sysv/linux/x86_64/init-first.c
+++ b/sysdeps/unix/sysv/linux/x86_64/init-first.c
@@ -17,6 +17,8 @@
    02111-1307 USA.  */
 
 #ifdef SHARED
+# include <time.h>
+# include <sysdep.h>
 # include <dl-vdso.h>
 # include <bits/libc-vdso.h>
 
@@ -27,12 +29,17 @@ strong_alias (__vdso_clock_gettime, __GI___vdso_clock_gettime attribute_hidden)
 long int (*__vdso_getcpu) (unsigned *, unsigned *, void *) attribute_hidden;
 
 
+extern long int __syscall_clock_gettime (clockid_t, struct timespec *);
+
+
 static inline void
 _libc_vdso_platform_setup (void)
 {
   PREPARE_VERSION (linux26, "LINUX_2.6", 61765110);
 
   void *p = _dl_vdso_vsym ("clock_gettime", &linux26);
+  if (p == NULL)
+    p = __syscall_clock_gettime;
   PTR_MANGLE (p);
   __GI___vdso_clock_gettime = p;
 
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index 3e231a0b61..ccddb84229 100644
--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -14,6 +14,7 @@ semop		-	semop		i:ipi	__semop		semop
 semtimedop	-	semtimedop	i:ipip	semtimedop
 semget		-	semget		i:iii	__semget	semget
 semctl		-	semctl		i:iiii	__semctl	semctl
+syscall_clock_gettime	EXTRA	clock_gettime	Ei:ip		__syscall_clock_gettime
 
 
 # proper socket implementations: