[PATCH v2 07/12] elf: Move vDSO setup to rtld (BZ#24967)

Florian Weimer fweimer@redhat.com
Fri Dec 13 12:12:00 GMT 2019


* Adhemerval Zanella:

> diff --git a/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c b/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c
> index 07d38466e2..6475840117 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c
> +++ b/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c
> @@ -38,12 +38,9 @@ __gettimeofday_vsyscall (struct timeval *restrict tv, void *restrict tz)
>  }
>  
>  #ifdef SHARED
> -# include <dl-vdso.h>
> -# include <sysdep-vdso.h>
> -
>  # define INIT_ARCH()
>  libc_ifunc (__gettimeofday,
> -	    (get_vdso_symbol (HAVE_GETTIMEOFDAY_VSYSCALL)
> +	    (GLRO(dl_vdso_gettimeofday)
>  	    ?: __gettimeofday_vsyscall))

This IFUNC resolver is still not valid because _rtld_global_ro has a
relocation dependency.

What we should do instead is to patch the vDSO function pointers (and
pretty much all shared variables, including the page size) into
libc.so.6 right after loading it (before relocation).  I had hoped to
post a patch for this, but the prerequisite

  <https://sourceware.org/ml/libc-alpha/2019-11/msg00977.html>

has not been reviewed.  It provides _dl_lookup_direct, which we could
use to get access to this global variables structure very efficiently.

Thanks,
Florian



More information about the Libc-alpha mailing list