From: Adhemerval Zanella Date: Mon, 20 Jan 2014 18:29:51 +0000 (-0600) Subject: PowerPC: Fix gettimeofday ifunc selection X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1442655ba419867ce1a045a97cdd7904ac1ad516;p=thirdparty%2Fglibc.git 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. It fixes BZ#16431. --- diff --git a/ChangeLog b/ChangeLog index aa456cfa384..499d43cdb64 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2014-01-20 Adhemerval Zanella + + [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. + 2014-01-16 Adhemerval Zanella [BZ#16430] diff --git a/NEWS b/NEWS index a2eb3009686..aa9544fa303 100644 --- a/NEWS +++ b/NEWS @@ -10,8 +10,8 @@ Version 2.16.1 * The following bugs are resolved with this release: 6530, 14195, 14547, 14459, 14476, 14562, 14621, 14648, 14699, 14756, 14831, - 15078, 15754, 15755, 16072, 16617, 17048, 17137, 17187, 17325, 17625, - 17630. + 15078, 15754, 15755, 16072, 16431, 16617, 17048, 17137, 17187, 17325, + 17625, 17630. * CVE-2104-7817 The wordexp function could ignore the WRDE_NOCMD flag under certain input conditions resulting in the execution of a shell for diff --git a/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c b/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c index cc5d82e10a3..267fa1dbb47 100644 --- a/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c +++ b/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c @@ -34,9 +34,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");