diff mbox series

linux: Use GLRO(dl_vdso_gettimeofday) on gettimeofday

Message ID 20240904161947.821553-1-adhemerval.zanella@linaro.org
State New
Headers show
Series linux: Use GLRO(dl_vdso_gettimeofday) on gettimeofday | expand

Commit Message

Adhemerval Zanella Netto Sept. 4, 2024, 4:17 p.m. UTC
The BZ#24967 fix (1bdda52fe92fd01b424c) missed the gettimeofday for
architectures that define USE_IFUNC_GETTIMEOFDAY.  Although it is not
an issue, since there is no pointer mangling, there is also no need
to call dl_vdso_vsym since the vDSO setup was already done by the
loader.

Checked on x86_64-linux-gnu and i686-linux-gnu.
---
 sysdeps/unix/sysv/linux/gettimeofday.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Florian Weimer Sept. 4, 2024, 5:09 p.m. UTC | #1
* Adhemerval Zanella:

> The BZ#24967 fix (1bdda52fe92fd01b424c) missed the gettimeofday for
> architectures that define USE_IFUNC_GETTIMEOFDAY.  Although it is not
> an issue, since there is no pointer mangling, there is also no need
> to call dl_vdso_vsym since the vDSO setup was already done by the
> loader.

What's the impact?  Is this an actually visible bug (like always
performing the syscall)?

Thanks,
Florian
Adhemerval Zanella Netto Sept. 4, 2024, 5:31 p.m. UTC | #2
On 04/09/24 14:09, Florian Weimer wrote:
> * Adhemerval Zanella:
> 
>> The BZ#24967 fix (1bdda52fe92fd01b424c) missed the gettimeofday for
>> architectures that define USE_IFUNC_GETTIMEOFDAY.  Although it is not
>> an issue, since there is no pointer mangling, there is also no need
>> to call dl_vdso_vsym since the vDSO setup was already done by the
>> loader.
> 
> What's the impact?  Is this an actually visible bug (like always
> performing the syscall)?

I don't think this is a bug, it will just redo the dl_vdso_vsym
already done by the loader (so waste some cycles) when gettimeofday
is resolved.
diff mbox series

Patch

diff --git a/sysdeps/unix/sysv/linux/gettimeofday.c b/sysdeps/unix/sysv/linux/gettimeofday.c
index 7ab147c614..94cc433202 100644
--- a/sysdeps/unix/sysv/linux/gettimeofday.c
+++ b/sysdeps/unix/sysv/linux/gettimeofday.c
@@ -36,12 +36,10 @@  __gettimeofday_syscall (struct timeval *restrict tv, void *restrict tz)
   return INLINE_SYSCALL_CALL (gettimeofday, tv, tz);
 }
 
-# undef INIT_ARCH
-# define INIT_ARCH() \
-  void *vdso_gettimeofday = dl_vdso_vsym (HAVE_GETTIMEOFDAY_VSYSCALL)
 libc_ifunc (__gettimeofday,
-	    vdso_gettimeofday ? VDSO_IFUNC_RET (vdso_gettimeofday)
-			      : (void *) __gettimeofday_syscall)
+	    GLRO(dl_vdso_gettimeofday) != NULL
+	    ? VDSO_IFUNC_RET (GLRO(dl_vdso_gettimeofday))
+	    : (void *) __gettimeofday_syscall)
 
 # else
 int