This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] PowerPC: Fix gettimeofday ifunc selection


The IFUNC selector for gettimeofday runs before _libc_vdso_platform_setup where
__vdso_gettimeofday is set. The selector then sets __gettimeofday (the internal
version used within GLIBC) to use the system call version instead of the vDSO one.
This patch changes the check if vDSO is available to get its value directly
instead of rely on __vdso_gettimeofday.

This patch changes it by getting the vDSO value directly. This is intended to be
applied on top of 'PowerPC: Fix ftime gettimeofday internal call returning bogus'.

Tested on PPC64 and PPC32.

---

2014-01-13  Adhemerval Zanella  <azanella@linux.vnet.ibm.com>

	[BZ#16431]
        * sysdeps/unix/sysv/linux/powerpc/gettimeofday.c (__gettimeofday):
	Adjust the vDSO correctly for internal calls.
	* sysdeps/unix/sysv/linux/powerpc/time.c (time): Likewise.

--

diff --git a/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c b/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c
index 2085b68..97ea2a4 100644
--- a/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c
+++ b/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c
@@ -35,9 +35,12 @@ __gettimeofday_syscall (struct timeval *tv, struct timezone *tz)
 void *
 gettimeofday_ifunc (void)
 {
+  PREPARE_VERSION (linux2615, "LINUX_2.6.15", 123718565);
+
   /* If the vDSO is not available we fall back syscall.  */
-  return (__vdso_gettimeofday ? VDSO_IFUNC_RET (__vdso_gettimeofday)
-	  : __gettimeofday_syscall);
+  void *vdso_gettimeofday = _dl_vdso_vsym ("__kernel_gettimeofday", &linux2615);
+  return (vdso_gettimeofday ? VDSO_IFUNC_RET (vdso_gettimeofday)
+	  : (void*)__gettimeofday_syscall);
 }
 asm (".type __gettimeofday, %gnu_indirect_function");
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/time.c b/sysdeps/unix/sysv/linux/powerpc/time.c
index ab53fd9..0e0097b 100644
--- a/sysdeps/unix/sysv/linux/powerpc/time.c
+++ b/sysdeps/unix/sysv/linux/powerpc/time.c
@@ -45,9 +45,12 @@ time_syscall (time_t *t)
 void *
 time_ifunc (void)
 {
+  PREPARE_VERSION (linux2615, "LINUX_2.6.15", 123718565);
+
   /* If the vDSO is not available we fall back to the syscall.  */
-  return (__vdso_time ? VDSO_IFUNC_RET (__vdso_time)
-	  : time_syscall);
+  void *vdso_time = _dl_vdso_vsym ("__kernel_time", &linux2615);
+  return (vdso_time ? VDSO_IFUNC_RET (vdso_time)
+	  : (void*)time_syscall);
 }
 asm (".type time, %gnu_indirect_function");


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]