From patchwork Thu Dec 12 18:16:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 181505 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp1117890och; Thu, 12 Dec 2019 10:17:06 -0800 (PST) X-Google-Smtp-Source: APXvYqzL5DxW/glXZ2Q/SWxBWL2a5yM3apWTzsU3x0/oxCur0T3dz3PEuDewvA4YE1sjjIl8l4Ix X-Received: by 2002:a05:6830:2111:: with SMTP id i17mr9046230otc.24.1576174626621; Thu, 12 Dec 2019 10:17:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576174626; cv=none; d=google.com; s=arc-20160816; b=BfgI432X4h9QwVlwsKAEecU7kJC1iLoroJZXRehoH5G99Xnp60betZR5nA+IQUk3p1 uAaqs8veHEn6QtcaxKu22Ipx3Yo4DO8S2JZFqGc/Jf17ew9mx5fm6EVQ0Bfv6JedMut3 WVHZ1VhVP3Sb3l8dKKOE7il6kRIq87NsCfRF2KnmhMN+A4CrrdfIibBitpkRxEv6scLm cdYG7bgL73pCJYsRCvjVMhSLvOuaq7eNL0AQwe1ejOaLZ2wSkVjQ5Uj/0t18J+dP12GN qyyFu4S9Q8KNQ0YoEyHutoK68ABJS5I1D0omXZlwXuT34cRqRRsyOon4qmySzzz4Xj/+ AARQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:to:from:dkim-signature:delivered-to:sender :list-help:list-post:list-archive:list-subscribe:list-unsubscribe :list-id:precedence:mailing-list:dkim-signature:domainkey-signature; bh=lFTQaWbYPRg4+/G8yGYrNe6Oj2XHrxWw8loDmUxeMxw=; b=oC7RpvhhbKeFPDEHF+IzYi4ar9RnicAICqvDxcEKpg49GslRgXn33kClDIgQ3vjxPK t1ffoAbTdc7NPfRLGkr+jpvzjokEQ5aS0CgKXo03ne0QrlxKdMc3ZLHnW4+OmAw206aG nd/4BBCzwzt4IYmGnT0VqFtnlEYwEvZoCyZj6en/mldCVDSIe8CT6VNpGY1/thaS9LYk RQ2W3MLxSQNJDc36lGH4DGWwhdD/Juw5MZzJjtxaYwcDMPdoJxCTDq6dTeQoX+7ZsoEy ry4i/uAHv9Y3TsQucfpWrWvU1xORrX40XNtmfynRSg9ErM6f5mh71fnQh66PC4VKMVNg A8Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=Y4Gezxir; dkim=pass header.i=@linaro.org header.s=google header.b=PhlBEtNe; spf=pass (google.com: domain of libc-alpha-return-108017-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-108017-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id o13si3650079otp.27.2019.12.12.10.17.06 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Dec 2019 10:17:06 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-108017-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=Y4Gezxir; dkim=pass header.i=@linaro.org header.s=google header.b=PhlBEtNe; spf=pass (google.com: domain of libc-alpha-return-108017-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-108017-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id; q=dns; s= default; b=WJU6Un3wXu1V3u3UqjaQHcGF+i62fwWzPIENcMbC8f0CObQtCmLXL rKqCOqTgz7JIl+mZfKtRy0Zjcw7BYLZq4V6IguBksw63B7nyDiTz/jpDUVo3xlxT CrVYpY60ACO3/oUZYKdFQSpywrXzFQD5Ux5HoW5+3sEBGWFOKRYhUQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id; s=default; bh=NQJDvYMphFKrkjoH+Bgika18mxk=; b=Y4Gezxirp8uFvVvwz76PQ7WNf3Nq TmcFXmeQk3PoW64fCWfZJaaVQYu6//ScmbRH73HodT+jgSjWwnBYNNIUwTr4w82J jQ+9RYipp8QmOTgcIPsl25xdfqevZIEWVrP5FuqCrXkPBFSochMccpIzIPmdMhZW nyOc/dR7cjLyjyU= Received: (qmail 43496 invoked by alias); 12 Dec 2019 18:16:28 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 43347 invoked by uid 89); 12 Dec 2019 18:16:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Spam-Relays-External:209.85.222.65, 5.1, H*RU:209.85.222.65, 3324 X-HELO: mail-ua1-f65.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id; bh=lFTQaWbYPRg4+/G8yGYrNe6Oj2XHrxWw8loDmUxeMxw=; b=PhlBEtNeyWgz3KKEmD6NYYhD4H0UAfGyFX+J4ExLYCVx0CBf2hZPn+VQ0UTKAkd4LC rD611kbv7/hCjr5/hUHJIyD0oLc6vT2oIXBOlNUQBGat/24/DLD1XBzE096mVqinomNA 5X2jPuJyZGolWkxQp0mGfBoXuM9TUB90bMmY4h7BKtL92xVeJnFRwsptBjuUvTUuUSi6 vdFpbZf2kCyziXMQ6OxrBgnLtT4Q+e7SJFVnO+vxwxwR6KTq9iUws3Q0Um1x7u2kiOcI nGntOveFC+T3G7sqwAQKH7aXx3S9KWEvJctY2q+IsB4jF8xhjQSulMX2sHRJmHim+YP6 GOXA== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 01/12] linux: Fix vDSO macros build with time64 interfaces Date: Thu, 12 Dec 2019 15:16:03 -0300 Message-Id: <20191212181614.31782-1-adhemerval.zanella@linaro.org> As indicated on libc-help [1] the ec138c67cb commit broke 32-bit builds when configured with --enable-kernel=5.1 or higher. The scenario 10 from [2] might also occur in this configuration and INLINE_VSYSCALL will try to use the vDSO symbol and HAVE_CLOCK_GETTIME64_VSYSCALL does not set HAVE_VSYSCALL prior its usage. Also, there is no easy way to just enable the code to use one vDSO sysmbo since the macro INLINE_VSYSCALL is redefined if HAVE_VSYSCALL is set. Instead of adding more pre-processor handling and making the code even more convoluted, this patch removes the requirement of defining HAVE_VSYSCALL before including sysdep-vdso.h to enable vDSO usage. The INLINE_VSYSCALL now only tries to call the vDSO symbol through the function pointer, the fallback code to try the syscall is done explicitly. The internal INLINE_VSYSCALL_CALL semantic is also changed to return a negative errno value in case of an error, it allows simplify INLINE_VSYSCALL implementation. The macro is now expect to be called inside the HAVE_*_VSYSCALL and it does not fallback to call the syscall (this should be done explicitly). Also, calling the INLINE_VSYSCALL macro with a vDSO name not defined by the architecture will trigger a build error. Internally it is also simplified to expected a negative value with errno embedded similar on how the Linux syscall work. It simplifies error handling. Both clock_getres and clock_gettime vDSO code for time64_t were removed since there is no vDSO setup code for the symbol (currently an architecture can not set HAVE_CLOCK_GETTIME64_VSYSCALL). Checked on i686-linux-gnu (default and with --enable-kernel=5.1), x86_64-linux-gnu, aarch64-linux-gnu, and powerpc64le-linux-gnu. I also checked against a build to mips64-linux-gnu and sparc64-linux-gnu. [1] https://sourceware.org/ml/libc-help/2019-12/msg00014.html --- .../unix/sysv/linux/aarch64/gettimeofday.c | 8 +- sysdeps/unix/sysv/linux/clock_getres.c | 43 ++++++---- sysdeps/unix/sysv/linux/clock_gettime.c | 45 +++++++---- sysdeps/unix/sysv/linux/getcpu.c | 13 +-- sysdeps/unix/sysv/linux/mips/sysdep.h | 16 ---- .../sysv/linux/powerpc/get_timebase_freq.c | 3 +- .../unix/sysv/linux/powerpc/gettimeofday.c | 8 +- .../sysv/linux/powerpc/powerpc32/sysdep.h | 10 ++- .../sysv/linux/powerpc/powerpc64/sysdep.h | 10 ++- sysdeps/unix/sysv/linux/powerpc/time.c | 9 +-- sysdeps/unix/sysv/linux/sched_getcpu.c | 17 ++-- sysdeps/unix/sysv/linux/sparc/sysdep.h | 7 -- sysdeps/unix/sysv/linux/sysdep-vdso.h | 79 +++++-------------- sysdeps/unix/sysv/linux/x86/gettimeofday.c | 8 +- sysdeps/unix/sysv/linux/x86/time.c | 11 +-- 15 files changed, 117 insertions(+), 170 deletions(-) -- 2.17.1 diff --git a/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c b/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c index 7e772e05ce..07d38466e2 100644 --- a/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c +++ b/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c @@ -22,10 +22,6 @@ #include #include - -#ifdef HAVE_GETTIMEOFDAY_VSYSCALL -# define HAVE_VSYSCALL -#endif #include /* Used as a fallback in the ifunc resolver if VDSO is not available @@ -36,7 +32,9 @@ __gettimeofday_vsyscall (struct timeval *restrict tv, void *restrict tz) if (__glibc_unlikely (tz != 0)) memset (tz, 0, sizeof *tz); - return INLINE_VSYSCALL (gettimeofday, 2, tv, tz); + if (INLINE_VSYSCALL (gettimeofday, 2, tv, tz) == 0) + return 0; + return INLINE_SYSCALL_CALL (gettimeofday, tv, tz); } #ifdef SHARED diff --git a/sysdeps/unix/sysv/linux/clock_getres.c b/sysdeps/unix/sysv/linux/clock_getres.c index 9497f78787..6c12f1d1e9 100644 --- a/sysdeps/unix/sysv/linux/clock_getres.c +++ b/sysdeps/unix/sysv/linux/clock_getres.c @@ -20,9 +20,6 @@ #include #include -#ifdef HAVE_CLOCK_GETRES_VSYSCALL -# define HAVE_VSYSCALL -#endif #include #include #include @@ -31,25 +28,39 @@ int __clock_getres64 (clockid_t clock_id, struct __timespec64 *res) { + int r = -1; + #ifdef __ASSUME_TIME64_SYSCALLS -# ifndef __NR_clock_getres_time64 - return INLINE_VSYSCALL (clock_getres, 2, clock_id, res); + /* 64 bit ABIs or Newer 32-bit ABIs that only support 64-bit time_t. */ +# ifdef __NR_clock_getres_time64 + r = INLINE_SYSCALL_CALL (clock_getres_time64, clock_id, res); # else - return INLINE_SYSCALL (clock_getres_time64, 2, clock_id, res); +# ifdef HAVE_CLOCK_GETRES_VSYSCALL + r = INLINE_VSYSCALL (clock_getres, 2, clock_id, res); +# endif + if (r == -1) + r = INLINE_SYSCALL_CALL (clock_getres, clock_id, res); # endif #else + /* Old 32-bit ABI with possible 64-bit time_t support. */ # ifdef __NR_clock_getres_time64 - int ret = INLINE_SYSCALL (clock_getres_time64, 2, clock_id, res); - if (ret == 0 || errno != ENOSYS) - return ret; + r = INLINE_SYSCALL_CALL (clock_getres_time64, clock_id, res); # endif - struct timespec ts32; - int retval = INLINE_VSYSCALL (clock_getres, 2, clock_id, &ts32); - if (! retval && res) - *res = valid_timespec_to_timespec64 (ts32); - - return retval; + if (r == -1) + { + /* Fallback code that uses 32-bit support. */ + struct timespec ts32; +# ifdef HAVE_CLOCK_GETRES_VSYSCALL + r = INLINE_VSYSCALL (clock_getres, 2, clock_id, &ts32); +# endif + if (r == -1) + r = INLINE_SYSCALL_CALL (clock_getres, clock_id, &ts32); + if (r == 0) + *res = valid_timespec_to_timespec64 (ts32); + } #endif + + return r; } #if __TIMESIZE != 64 @@ -60,7 +71,7 @@ __clock_getres (clockid_t clock_id, struct timespec *res) int retval; retval = __clock_getres64 (clock_id, &ts64); - if (! retval && res) + if (retval == 0 && res ! = NULL) *res = valid_timespec64_to_timespec (ts64); return retval; diff --git a/sysdeps/unix/sysv/linux/clock_gettime.c b/sysdeps/unix/sysv/linux/clock_gettime.c index 875c4fe905..4ea56c9a4b 100644 --- a/sysdeps/unix/sysv/linux/clock_gettime.c +++ b/sysdeps/unix/sysv/linux/clock_gettime.c @@ -21,10 +21,6 @@ #include #include #include "kernel-posix-cpu-timers.h" - -#ifdef HAVE_CLOCK_GETTIME_VSYSCALL -# define HAVE_VSYSCALL -#endif #include #include @@ -33,24 +29,39 @@ int __clock_gettime64 (clockid_t clock_id, struct __timespec64 *tp) { + int r = -1; + #ifdef __ASSUME_TIME64_SYSCALLS -# ifndef __NR_clock_gettime64 -# define __NR_clock_gettime64 __NR_clock_gettime -# define __vdso_clock_gettime64 __vdso_clock_gettime + /* 64 bit ABIs or Newer 32-bit ABIs that only support 64-bit time_t. */ +# ifdef __NR_clock_gettime64 + r = INLINE_SYSCALL_CALL (clock_gettime64, clock_id, tp); +# else +# ifdef HAVE_CLOCK_GETTIME_VSYSCALL + r = INLINE_VSYSCALL (clock_gettime, 2, clock_id, tp); +# endif + if (r == -1) + r = INLINE_SYSCALL_CALL (clock_gettime, clock_id, tp); # endif - return INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp); #else -# if defined HAVE_CLOCK_GETTIME64_VSYSCALL - int ret64 = INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp); - if (ret64 == 0 || errno != ENOSYS) - return ret64; + /* Old 32-bit ABI with possible 64-bit time_t support. */ +# ifdef __NR_clock_gettime64 + r = INLINE_SYSCALL_CALL (clock_gettime64, clock_id, tp); # endif - struct timespec tp32; - int ret = INLINE_VSYSCALL (clock_gettime, 2, clock_id, &tp32); - if (ret == 0) - *tp = valid_timespec_to_timespec64 (tp32); - return ret; + if (r == -1) + { + /* Fallback code that uses 32-bit support. */ + struct timespec tp32; +# ifdef HAVE_CLOCK_GETTIME_VSYSCALL + r = INLINE_VSYSCALL (clock_gettime, 2, clock_id, &tp32); +# endif + if (r == -1) + r = INLINE_SYSCALL_CALL (clock_gettime, clock_id, &tp32); + if (r == 0) + *tp = valid_timespec_to_timespec64 (tp32); + } #endif + + return r; } #if __TIMESIZE != 64 diff --git a/sysdeps/unix/sysv/linux/getcpu.c b/sysdeps/unix/sysv/linux/getcpu.c index fdd27203af..8b26b3e19e 100644 --- a/sysdeps/unix/sysv/linux/getcpu.c +++ b/sysdeps/unix/sysv/linux/getcpu.c @@ -18,21 +18,16 @@ #include #include #include - -#ifdef HAVE_GETCPU_VSYSCALL -# define HAVE_VSYSCALL -#endif #include int __getcpu (unsigned int *cpu, unsigned int *node) { -#ifdef __NR_getcpu - return INLINE_VSYSCALL (getcpu, 3, cpu, node, NULL); -#else - __set_errno (ENOSYS); - return -1; +#ifdef HAVE_GETCPU_VSYSCALL + if (INLINE_VSYSCALL (getcpu, 3, cpu, node, NULL) == 0) + return 0; #endif + return INLINE_SYSCALL_CALL (getcpu, cpu, node, NULL); } weak_alias (__getcpu, getcpu) libc_hidden_def (__getcpu) diff --git a/sysdeps/unix/sysv/linux/mips/sysdep.h b/sysdeps/unix/sysv/linux/mips/sysdep.h index 82a3cf9f3d..2470f32d58 100644 --- a/sysdeps/unix/sysv/linux/mips/sysdep.h +++ b/sysdeps/unix/sysv/linux/mips/sysdep.h @@ -22,19 +22,3 @@ /* List of system calls which are supported as vsyscalls. */ #define HAVE_CLOCK_GETTIME_VSYSCALL "__vdso_clock_gettime" #define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday" - -#ifndef __ASSEMBLER__ - -/* Standard MIPS syscalls have an error flag, and return a positive errno - when the error flag is set. Emulate this behaviour for vsyscalls so that - the INTERNAL_SYSCALL_{ERROR_P,ERRNO} macros work correctly. */ -#define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \ - ({ \ - long _ret = funcptr (args); \ - err = ((unsigned long) (_ret) >= (unsigned long) -4095L); \ - if (err) \ - _ret = -_ret; \ - _ret; \ - }) - -#endif /* __ASSEMBLER__ */ diff --git a/sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c b/sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c index 29b6624b9a..32b9ab5da5 100644 --- a/sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c +++ b/sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c @@ -106,7 +106,6 @@ __get_timebase_freq (void) if (vdsop == NULL) return get_timebase_freq_fallback (); - INTERNAL_SYSCALL_DECL (err); - return INTERNAL_VSYSCALL_CALL_TYPE (vdsop, err, uint64_t, 0); + return INTERNAL_VSYSCALL_CALL_TYPE (vdsop, uint64_t, 0); } weak_alias (__get_timebase_freq, __ppc_get_timebase_freq) diff --git a/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c b/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c index 18d8f7cb7a..1982b1e025 100644 --- a/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c +++ b/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c @@ -17,10 +17,6 @@ #include #include - -#ifdef HAVE_GETTIMEOFDAY_VSYSCALL -# define HAVE_VSYSCALL -#endif #include static int @@ -29,7 +25,9 @@ __gettimeofday_syscall (struct timeval *restrict tv, void *restrict tz) if (__glibc_unlikely (tz != 0)) memset (tz, 0, sizeof *tz); - return INLINE_VSYSCALL (gettimeofday, 2, tv, tz); + if (INLINE_VSYSCALL (gettimeofday, 2, tv, tz) == 0) + return 0; + return INLINE_SYSCALL_CALL (gettimeofday, tv, tz); } #ifdef SHARED diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h index a3bb552254..3d208dc192 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h @@ -41,7 +41,7 @@ function call, with the exception of LR (which is needed for the "sc; bnslr+" sequence) and CR (where only CR0.SO is clobbered to signal an error return status). */ -# define INTERNAL_VSYSCALL_CALL_TYPE(funcptr, err, type, nr, args...) \ +# define INTERNAL_VSYSCALL_CALL_TYPE(funcptr, type, nr, args...) \ ({ \ register void *r0 __asm__ ("r0"); \ register long int r3 __asm__ ("r3"); \ @@ -63,13 +63,15 @@ : "+r" (r0), "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), "+r" (r7), \ "+r" (r8), "+r" (r9), "+r" (r10), "+r" (r11), "+r" (r12) \ : : "cr0", "ctr", "lr", "memory"); \ - err = (long int) r0; \ + long int err = (long int) r0; \ __asm__ __volatile__ ("" : "=r" (rval) : "r" (r3), "r" (r4)); \ + if (INTERNAL_SYSCALL_ERROR_P (rval, err)) \ + rval = -rval; \ rval; \ }) -#define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \ - INTERNAL_VSYSCALL_CALL_TYPE(funcptr, err, long int, nr, args) +#define INTERNAL_VSYSCALL_CALL(funcptr, nr, args...) \ + INTERNAL_VSYSCALL_CALL_TYPE(funcptr, long int, nr, args) # undef INLINE_SYSCALL # define INLINE_SYSCALL(name, nr, args...) \ diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h index 207d9d5709..65f5789c63 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h @@ -51,7 +51,7 @@ gave back in the non-error (CR0.SO cleared) case, otherwise (CR0.SO set) the negation of the return value in the kernel gets reverted. */ -#define INTERNAL_VSYSCALL_CALL_TYPE(funcptr, err, type, nr, args...) \ +#define INTERNAL_VSYSCALL_CALL_TYPE(funcptr, type, nr, args...) \ ({ \ register void *r0 __asm__ ("r0"); \ register long int r3 __asm__ ("r3"); \ @@ -70,13 +70,15 @@ : "+r" (r0), "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), \ "+r" (r7), "+r" (r8) \ : : "r9", "r10", "r11", "r12", "cr0", "ctr", "lr", "memory"); \ - err = (long int) r0; \ + long int err = (long int) r0; \ __asm__ __volatile__ ("" : "=r" (rval) : "r" (r3)); \ + if (INTERNAL_SYSCALL_ERROR_P (rval, err)) \ + rval = -rval; \ rval; \ }) -#define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \ - INTERNAL_VSYSCALL_CALL_TYPE(funcptr, err, long int, nr, args) +#define INTERNAL_VSYSCALL_CALL(funcptr, nr, args...) \ + INTERNAL_VSYSCALL_CALL_TYPE(funcptr, long int, nr, args) /* This version is for kernels that implement system calls that behave like function calls as far as register saving. */ diff --git a/sysdeps/unix/sysv/linux/powerpc/time.c b/sysdeps/unix/sysv/linux/powerpc/time.c index 80a4c73416..2059097c0a 100644 --- a/sysdeps/unix/sysv/linux/powerpc/time.c +++ b/sysdeps/unix/sysv/linux/powerpc/time.c @@ -18,16 +18,15 @@ #include #include - -#ifdef HAVE_TIME_VSYSCALL -# define HAVE_VSYSCALL -#endif #include static time_t time_vsyscall (time_t *t) { - return INLINE_VSYSCALL (time, 1, t); + time_t ret = INLINE_VSYSCALL (time, 1, t); + if (ret != -1) + return ret; + return INLINE_SYSCALL_CALL (time, t); } #ifdef SHARED diff --git a/sysdeps/unix/sysv/linux/sched_getcpu.c b/sysdeps/unix/sysv/linux/sched_getcpu.c index 65dd9fdda7..23a60f1b52 100644 --- a/sysdeps/unix/sysv/linux/sched_getcpu.c +++ b/sysdeps/unix/sysv/linux/sched_getcpu.c @@ -18,22 +18,17 @@ #include #include #include - -#ifdef HAVE_GETCPU_VSYSCALL -# define HAVE_VSYSCALL -#endif #include int sched_getcpu (void) { -#ifdef __NR_getcpu unsigned int cpu; - int r = INLINE_VSYSCALL (getcpu, 3, &cpu, NULL, NULL); - - return r == -1 ? r : cpu; -#else - __set_errno (ENOSYS); - return -1; + int r = -1; +#ifdef HAVE_GETCPU_VSYSCALL + r = INLINE_VSYSCALL (getcpu, 3, &cpu, NULL, NULL); #endif + if (r == -1) + r = INLINE_SYSCALL_CALL (getcpu, &cpu, NULL, NULL); + return r == -1 ? r : cpu; } diff --git a/sysdeps/unix/sysv/linux/sparc/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sysdep.h index f38144c912..4ae0fca6ee 100644 --- a/sysdeps/unix/sysv/linux/sparc/sysdep.h +++ b/sysdeps/unix/sysv/linux/sparc/sysdep.h @@ -34,13 +34,6 @@ #else /* __ASSEMBLER__ */ -#define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \ - ({ \ - long _ret = funcptr (args); \ - err = ((unsigned long) (_ret) >= (unsigned long) -4095L); \ - _ret; \ - }) - # define VDSO_NAME "LINUX_2.6" # define VDSO_HASH 61765110 diff --git a/sysdeps/unix/sysv/linux/sysdep-vdso.h b/sysdeps/unix/sysv/linux/sysdep-vdso.h index cf614fbf8b..04525340a5 100644 --- a/sysdeps/unix/sysv/linux/sysdep-vdso.h +++ b/sysdeps/unix/sysv/linux/sysdep-vdso.h @@ -21,69 +21,30 @@ #include +/* Return the errno value as a negative value in case of an error or 0 or + positive value otherwise. */ #ifndef INTERNAL_VSYSCALL_CALL -# define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \ +# define INTERNAL_VSYSCALL_CALL(funcptr, nr, args...) \ funcptr (args) #endif -#ifdef HAVE_VSYSCALL - -# include - -# define INLINE_VSYSCALL(name, nr, args...) \ - ({ \ - __label__ out; \ - __label__ iserr; \ - INTERNAL_SYSCALL_DECL (sc_err); \ - long int sc_ret; \ - \ - __typeof (__vdso_##name) vdsop = __vdso_##name; \ - PTR_DEMANGLE (vdsop); \ - if (vdsop != NULL) \ - { \ - sc_ret = INTERNAL_VSYSCALL_CALL (vdsop, sc_err, nr, ##args); \ - if (!INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \ - goto out; \ - if (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err) != ENOSYS) \ - goto iserr; \ - } \ - \ - sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, ##args); \ - if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \ - { \ - iserr: \ - __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)); \ - sc_ret = -1L; \ - } \ - out: \ - sc_ret; \ - }) - -# define INTERNAL_VSYSCALL(name, err, nr, args...) \ - ({ \ - __label__ out; \ - long v_ret; \ - \ - __typeof (__vdso_##name) vdsop = __vdso_##name; \ - PTR_DEMANGLE (vdsop); \ - if (vdsop != NULL) \ - { \ - v_ret = INTERNAL_VSYSCALL_CALL (vdsop, err, nr, ##args); \ - if (!INTERNAL_SYSCALL_ERROR_P (v_ret, err) \ - || INTERNAL_SYSCALL_ERRNO (v_ret, err) != ENOSYS) \ - goto out; \ - } \ - v_ret = INTERNAL_SYSCALL (name, err, nr, ##args); \ - out: \ - v_ret; \ +#include + +#define INLINE_VSYSCALL(name, nr, args...) \ + ({ \ + long int sc_ret = -1; \ + __typeof (__vdso_##name) vdsop = __vdso_##name; \ + PTR_DEMANGLE (vdsop); \ + if (vdsop != NULL) \ + { \ + sc_ret = INTERNAL_VSYSCALL_CALL (vdsop, nr, ##args); \ + if ((unsigned long) sc_ret > -4096UL) \ + { \ + __set_errno (-sc_ret); \ + sc_ret = -1L; \ + } \ + } \ + sc_ret; \ }) -#else - -# define INLINE_VSYSCALL(name, nr, args...) \ - INLINE_SYSCALL (name, nr, ##args) -# define INTERNAL_VSYSCALL(name, err, nr, args...) \ - INTERNAL_SYSCALL (name, err, nr, ##args) - -#endif /* USE_VSYSCALL && defined HAVE_VSYSCALL */ #endif /* SYSDEP_VDSO_LINUX_H */ diff --git a/sysdeps/unix/sysv/linux/x86/gettimeofday.c b/sysdeps/unix/sysv/linux/x86/gettimeofday.c index 190127d31e..909575a7e3 100644 --- a/sysdeps/unix/sysv/linux/x86/gettimeofday.c +++ b/sysdeps/unix/sysv/linux/x86/gettimeofday.c @@ -18,10 +18,6 @@ #include #include - -#ifdef HAVE_GETTIMEOFDAY_VSYSCALL -# define HAVE_VSYSCALL -#endif #include static int @@ -30,7 +26,9 @@ __gettimeofday_syscall (struct timeval *restrict tv, void *restrict tz) if (__glibc_unlikely (tz != 0)) memset (tz, 0, sizeof *tz); - return INLINE_VSYSCALL (gettimeofday, 2, tv, tz); + if (INLINE_VSYSCALL (gettimeofday, 2, tv, tz) == 0) + return 0; + return INLINE_SYSCALL_CALL (gettimeofday, tv, tz); } #ifdef SHARED diff --git a/sysdeps/unix/sysv/linux/x86/time.c b/sysdeps/unix/sysv/linux/x86/time.c index 4a03c46d21..74bae4b07a 100644 --- a/sysdeps/unix/sysv/linux/x86/time.c +++ b/sysdeps/unix/sysv/linux/x86/time.c @@ -18,16 +18,17 @@ #include #include - -#ifdef HAVE_TIME_VSYSCALL -# define HAVE_VSYSCALL -#endif #include static time_t time_vsyscall (time_t *t) { - return INLINE_VSYSCALL (time, 1, t); +#ifdef HAVE_TIME_VSYSCALL + time_t ret = INLINE_VSYSCALL (time, 1, t); + if (ret != -1) + return ret; +#endif + return INLINE_SYSCALL_CALL (time, t); } #ifdef SHARED From patchwork Thu Dec 12 18:16:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 181502 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp1117478och; Thu, 12 Dec 2019 10:16:45 -0800 (PST) X-Google-Smtp-Source: APXvYqxq/yPf3uSkUR8KOm9J4yWRNM3qvnacTcadV0nVsVcS4K35VvwhZloIgwNJtmEe1WVX6C4Q X-Received: by 2002:a9d:7f16:: with SMTP id j22mr9362015otq.256.1576174604979; Thu, 12 Dec 2019 10:16:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576174604; cv=none; d=google.com; s=arc-20160816; b=HwCjevXif5dX/+CKNpTSkIH6+gRCu0iymEztjJ3yDDg68147P6jZ9Hq+bFhHvQuKIh j5x3HFfR1uiT41ahokFQbBYRos6WtPIcl7p8PR6gFl31MYZHZPd82wm4wuHQSH8OKRJJ 3n7Wr2PycHRID8jczyRpKMihQ4spyNdwudYElFE+AtyGL0sjIrGe1/qcGnPNyfg/PIPB L3K8XEOLlgQIPIwuGwFOJCvYCGq/xtF45AcxxoeP9oC+AEl+09rpreau0HJOmXKxLNCn o0uSbuN47jcOZX2l19CVEzisThWj9bJ51g6r2qYPyRFONRzM+QCKFP0ZTv8lRjnjAyQc uNzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=MF4x33SRx6/mN13qrnSIC+6NV8NstO3lzD0nBXp1jhs=; b=q4PFzhdzwxmu2zdjX17W0iY+KUI5jts66M5dITsNHAgJW+u6rLv7Mzsu3Z2kDQV6lX DKmjPpgjp3yIzvig9vohlnNxb4ij+2Yr9VL0jqd13QNS68HiIZ7CuctQnrLELiyIy5/N KrFqyXcQjgVRssaIrXb34HRHnNy+qXixKxFHjQRVKGpnGr6JNYgwsyuWnGpKnPXclO5R qlKS7VuqtGpk8Y5l+e1TR6G+El/P4Ys0LdWIaksshAChTBbPU6jQiZmFiWr6UDkfQJcQ oLQz1z2Ver3iB/sDPrgHIuisEjX4HMUepqhdWBW34aEgwIfGkRELlU6LsLDwaYXpTaIT bHDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=OtO1dYlK; dkim=pass header.i=@linaro.org header.s=google header.b=PUEpk8kb; spf=pass (google.com: domain of libc-alpha-return-108015-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-108015-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id w4si3673488otj.148.2019.12.12.10.16.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Dec 2019 10:16:44 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-108015-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=OtO1dYlK; dkim=pass header.i=@linaro.org header.s=google header.b=PUEpk8kb; spf=pass (google.com: domain of libc-alpha-return-108015-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-108015-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=OWxyz8rfywkqvKRmh2DtGz8ezUN8sGT uAbWo3a5nPG+acBTQVAj6g3Z0417HpFqJ1ooggsIO8lvZF83UdTEMKL5SweJ6yby XkBUKfXzfIXrb4oWgbtAfubieTPj7v9JwIDIhiY4q4+VTxpH2dK77klaiM0/8Sa5 k7rv9mhlEPGQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=o1sw+WlwtG7+OZAd30pEwa0xBVE=; b=OtO1d YlK+4OMNfLg+bM0jTxL1Uqt7tALb7QawIXYg/OBS9vk7QOodI+zFRDBZyCycnzrf bu3pxERTGpOe4P5DysDgcq6NBKlmeuv2MDO15EPpCjwq2Uc/5sfavy9eyoz9WbxX bcLK6Czq2RYXG5JZmzpNDfwKPXkFS8y+nSLy4o= Received: (qmail 43197 invoked by alias); 12 Dec 2019 18:16:26 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 43083 invoked by uid 89); 12 Dec 2019 18:16:25 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=sk:SINGLE_, HX-Received:a9f, HX-Languages-Length:2322, 3156 X-HELO: mail-ua1-f66.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=MF4x33SRx6/mN13qrnSIC+6NV8NstO3lzD0nBXp1jhs=; b=PUEpk8kblHSxUQOpah4AjqFt4jtdNBU30FKFwpgZ65zvjJns3iyj281YDZTy/qFZyx N1XWSa53CMjq+PnLKtz1K9xHJVbKn5Mr1AjijdYfqKIh+VW6U9B7CnDpI5kozdcGv7SI xwie2eB5ioXEDPfJvoD922UX8ydTjlBUa1mwqtZgdiKOeUFcSa2pJCkJ4ntUigPH77G5 SPxZTXsHH4w5W1H7ljvvhRp3LrkqjD+XANGWJM+f4+VP0ZQCIT4Ilr8aBm+S28ncv9xj 5QJzpw4uMZn4uqNaf+fBAB6tMezuJktwMmqvEbkGqqYG+U959/rr+W9ZhLlrQQW1FYLA QBJA== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH v2 02/12] linux: Update x86 vDSO symbols Date: Thu, 12 Dec 2019 15:16:04 -0300 Message-Id: <20191212181614.31782-2-adhemerval.zanella@linaro.org> In-Reply-To: <20191212181614.31782-1-adhemerval.zanella@linaro.org> References: <20191212181614.31782-1-adhemerval.zanella@linaro.org> Changes from previous version: - Assume HAVE_TIME_VSYSCALL on x86 time implementation. -- Add the missing time and clock_getres vDSO symbol names on x86. For time, the iFUNC already uses expected name so it affects only the static build. The clock_getres is a new implementation added on Linux 5.3 (f66501dc53e72). Checked on x86-linux-gnu and i686-linux-gnu. --- sysdeps/unix/sysv/linux/i386/sysdep.h | 2 ++ sysdeps/unix/sysv/linux/x86/time.c | 2 -- sysdeps/unix/sysv/linux/x86_64/sysdep.h | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h index 7066ddc214..b2e750d490 100644 --- a/sysdeps/unix/sysv/linux/i386/sysdep.h +++ b/sysdeps/unix/sysv/linux/i386/sysdep.h @@ -315,6 +315,8 @@ struct libc_do_syscall_args /* List of system calls which are supported as vsyscalls. */ # define HAVE_CLOCK_GETTIME_VSYSCALL "__vdso_clock_gettime" # define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday" +# define HAVE_TIME_VSYSCALL "__vdso_time" +# define HAVE_CLOCK_GETRES_VSYSCALL "__vdso_clock_getres" /* Define a macro which expands inline into the wrapper code for a system call. This use is for internal calls that do not need to handle errors diff --git a/sysdeps/unix/sysv/linux/x86/time.c b/sysdeps/unix/sysv/linux/x86/time.c index 74bae4b07a..0aee73826b 100644 --- a/sysdeps/unix/sysv/linux/x86/time.c +++ b/sysdeps/unix/sysv/linux/x86/time.c @@ -23,11 +23,9 @@ static time_t time_vsyscall (time_t *t) { -#ifdef HAVE_TIME_VSYSCALL time_t ret = INLINE_VSYSCALL (time, 1, t); if (ret != -1) return ret; -#endif return INLINE_SYSCALL_CALL (time, t); } diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h index 475b7d991a..965fd4b851 100644 --- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h +++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h @@ -376,7 +376,9 @@ /* List of system calls which are supported as vsyscalls. */ # define HAVE_CLOCK_GETTIME_VSYSCALL "__vdso_clock_gettime" # define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday" +# define HAVE_TIME_VSYSCALL "__vdso_time" # define HAVE_GETCPU_VSYSCALL "__vdso_getcpu" +# define HAVE_CLOCK_GETRES_VSYSCALL "__vdso_clock_getres" # define SINGLE_THREAD_BY_GLOBAL 1 From patchwork Thu Dec 12 18:16:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 181504 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp1117679och; Thu, 12 Dec 2019 10:16:54 -0800 (PST) X-Google-Smtp-Source: APXvYqyslPsc8BUsvhE65GkpXRcNVKsQRVZXQETkto48DRBOIAOk1s3WLYZFhnDsgDjtYtGJsyGK X-Received: by 2002:a9d:12ea:: with SMTP id g97mr9825798otg.105.1576174614711; Thu, 12 Dec 2019 10:16:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576174614; cv=none; d=google.com; s=arc-20160816; b=I8ig/ThDlDp7zwK2e7GiMW0llaV7N4XJFhLbXFZHisxiifEJUKFJK5NsmQDKoOE66g 4FyxHwqqsnDf4LeflhyZzplaAV9JC4LrJofxYTJ+PXdFqatVHRDSELV/3cJO6ERxsJCi OEABi/qU+p75fOG6BXCM3qYPd2TeH4ku7tioXkz5+U2RXvzNcZ02nMmVWxgDsoS7YdX4 d2KNqElw8Dv+PDAFpuOqWBcn6BxXABHa/oh6ap2c1IZ3VsnoNqFnir8YxwCbsEvur2pd qJzMU/2NcEYzFLBdG3ty0+NHrrX4f6Yju95whny37ILzzFQ9YPBxi48PS6X7ewbi1n8u Reyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=HJitG/Yd3dwei1YJX7OtRpoYVMl5njknGvKo52X6Du8=; b=jhimLSJBe+WomF88xueCxTQBlyzXCh2tGWeSXXQjZiuJFRQ9hP3SFpXGb72jU/uV0a 4F9m9eMeFg35abY2ICe1WgdfJbiqGVurbNnKER08bPFcBPu+9uatoaOeRahnzC+9r4+1 80LS3poBMtUyCbcjXbfOZcjPrB8sI+2B77rfsn/bAYe9wJ8t/6r2HmfneVQM9D833L3b BCoXsoiw6CZLEcX1cLJum8UtmUJ0by/HNELnzFXBucfZFZUC8S9KQCqRoTqy1QvRc9ew MmKDC/qU0ndDib7ZXnIfJl/dpyPWnUxGco6MsJNG93ytIkpWWU+WxmjVDhGAel+RWhch 4MsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=gBg91yvZ; dkim=pass header.i=@linaro.org header.s=google header.b=oyNaixCT; spf=pass (google.com: domain of libc-alpha-return-108016-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-108016-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id h11si3903038otr.197.2019.12.12.10.16.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Dec 2019 10:16:54 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-108016-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=gBg91yvZ; dkim=pass header.i=@linaro.org header.s=google header.b=oyNaixCT; spf=pass (google.com: domain of libc-alpha-return-108016-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-108016-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=W1bVDBrFGohGssahBrMyMlxpe/j08N/ nSm4FvD2ozg87K/4fgVCNU6b2p1irz5va6GYImJTlQ17k8CuZoSIWqnZboRcRlhj TDpcvbS/txrz/9ZoeKcDH8ADCxS0xadiTzz+Ln48/hsG7j1RdK0+7NE3GIJdiQAk ccPBPQOheZio= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=I159XlNrbSjcjxW9KzAX3DViluw=; b=gBg91 yvZ4AWvqiHXctR+sANccCqFL98p9p5afN8r9GbbDLwgbCBiWX8sSWixxoFW8yEIh 2tmWtmK7NrCGqRiJ6KF9OsYqA53wHyk6BoSFWasYGaGqok9vO8BVvsftDbpzT7la m0S+gljFOtx+SMGaqkhQuq2GlWNubbc8KDnG/4= Received: (qmail 43402 invoked by alias); 12 Dec 2019 18:16:27 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 43257 invoked by uid 89); 12 Dec 2019 18:16:26 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-vs1-f67.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=HJitG/Yd3dwei1YJX7OtRpoYVMl5njknGvKo52X6Du8=; b=oyNaixCTMlngJCVm0KL1F3MaamN07bCZ0oxH8m6KNBld81Tc/Dr/yy/5QRLuFuDdcg OqpKq/3VQmeJp5dziD8McqxlyKdpXgHSfJbbrYwPe0hqyxKTf2nPncNxmTXanLlXIYbe Ew3CE2TS+Ou6iSgDWpEf2oSFlGlUHCVHYUXALAAPqWQrooE0heo48Z8xRQOLzC2UrjFp wJBC/fuadBSW/liryUexYdWkBXBvOkTg4BrV2E+qof7A80iMIpwgkdV6wg3RIPn00VdX WRqfxhDpDV2+9UwLW2NfiGTkLQcrJHwFeaWyQQxPtz0lEAb0ZKk+OoTvgf/UWUrpeo4v c8Hw== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 03/12] x86: Make x32 use x86 time implementation Date: Thu, 12 Dec 2019 15:16:05 -0300 Message-Id: <20191212181614.31782-3-adhemerval.zanella@linaro.org> In-Reply-To: <20191212181614.31782-1-adhemerval.zanella@linaro.org> References: <20191212181614.31782-1-adhemerval.zanella@linaro.org> This is the only use of auto-generation syscall which uses a vDSO plus IFUNC and the current x86 generic implementation already covers the expected semantic. Checked on x86_64-linux-gnu-x32. --- sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list | 1 - 1 file changed, 1 deletion(-) -- 2.17.1 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list index 786c884232..58ea31d1fd 100644 --- a/sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list +++ b/sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list @@ -2,4 +2,3 @@ personality EXTRA personality Ei:i __personality personality posix_fadvise64 - fadvise64 Vi:iiii posix_fadvise posix_fadvise64 -time - time:__vdso_time@LINUX_2.6 Ei:P time From patchwork Thu Dec 12 18:16:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 181506 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp1118127och; Thu, 12 Dec 2019 10:17:16 -0800 (PST) X-Google-Smtp-Source: APXvYqwgV9CREAvy5HoK9l8+9WjtxgKZdpuUMrQwDUxSP5nW0P0jnDnBVhrLEwlH1ox9P3hAQSuJ X-Received: by 2002:a05:6830:1185:: with SMTP id u5mr8907226otq.147.1576174636567; Thu, 12 Dec 2019 10:17:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576174636; cv=none; d=google.com; s=arc-20160816; b=ZhzV8AxDrsYmu4+49xcaSpDSoSQMtY3XvMiMZFZp2CG/cgDF3r5JebVH39tRtkTmbd NzmlxldSCY31UH+zddWQ/ItsV8Z2FepB2UaOWblNsHf9jH3JzlJfBc52/FRnmcF9RdnB ip6oXzTVH63a3Rl43MLKnqdb6KcQ6oQSiMcnIlzi7+NZQ6623mHFl513xWXh+xdj7sUX DqikiA14RXfint8iaDUfitaojda7JDhPxxrOqTv7GIQ0Ruy5j2E6Cf2PFa6lWTlaw5If EwbFMYrjxya/DQW7uX4ksVBVBOXaYjB+KqsvOcTc/3LvDSlMtSkKNP2TZP/vhCgHBdbX fJxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=dFH9Te0U0mm8NW7zlYdzKl0T7cOE7/LDGlJNyIeGC5E=; b=Le9HE0uJs45MXCvCU3+LAI3I8CZLSIXGZvAcIlkpZ9KnsG6Zd3ntLgpWRInwyO1tlM vWeRwe3GZcR6ktha9noDkmNe4h2WaQgxK14/xgVandxEQHn/lwJpyfrKvKIJreMNh1uz cb6Fco9nm3egHUczNCyGDM8/dw2psbeMZARWh5xVgKxpWyCCieV5vzHsjZoN0vcPTlt9 Qio8LOECQSTVGl0arz0a5d7829SPovmofVe4vqL9j1pDHdTtj5Oq/J1einMK7tffsRXG mq8pdhXY84KIdtI7OCo05a01QYQq4mJwJr2/Ki0eKMXj/ZlyK5S+Gp6Dg9Kqc6LB7KSv kDVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=rDoVaQVu; dkim=pass header.i=@linaro.org header.s=google header.b=cGGtAdiR; spf=pass (google.com: domain of libc-alpha-return-108018-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-108018-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id s1si3628633otr.288.2019.12.12.10.17.16 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Dec 2019 10:17:16 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-108018-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=rDoVaQVu; dkim=pass header.i=@linaro.org header.s=google header.b=cGGtAdiR; spf=pass (google.com: domain of libc-alpha-return-108018-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-108018-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=b1rQTsrnKoa3P9EjT7zuah2i5Fo3IDL l4n1qV/da69LkDcq34ZNgLos8wCkEIpdWd20VcgVNwju/MBxAubkgWyiPN5aWaeF QkeRct+Yvc8EjR111vF9eJiLBh02Q75GD/dxT4PSPufLcFM0lOspaR2m6xG/3xHn R9CxdxmOehv8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=3ts0CaZvXVo+54h+VPIaV/aS4Ss=; b=rDoVa QVuBhP+iaHqFBaJDbmNIiVD38seX2OXvOm0L8Su3syL2b4WYEhYMzBzn8n5Nm6j+ 0FdptiuVOqcV3nm8IquP5Hr/Y5M/8PrZM0BwriOlTVCF1uocMZXtwazeXrFgeYQN xsOx0bGWTmo3oljWzyv/NYw5rGC5PW5kwtxFEA= Received: (qmail 43677 invoked by alias); 12 Dec 2019 18:16:29 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 43530 invoked by uid 89); 12 Dec 2019 18:16:28 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=H*RU:209.85.222.67, HX-Spam-Relays-External:209.85.222.67 X-HELO: mail-ua1-f67.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=dFH9Te0U0mm8NW7zlYdzKl0T7cOE7/LDGlJNyIeGC5E=; b=cGGtAdiRqH+r5O0jysCetlG34wM3iZ413HX4Pcnh5Uav7gM6yRIG9RWD0wygt5jTNl 4OrCTLNfEnDpdtD24VyQT0/DLIts/B287ny/CbMnsuPGuTjJ1buuXVwi/orgP3nAzYcO 4H4F9ob11z4AZrOd7YLhJ0jTRL06A2RfK647W0DNmN4tqGgH7grk+ftzYNSd/8C7gO0o s8x7B9t6twmCAPY0U6+53v2TySwrUtGPHiuCXmHxUSywOCHWG3AQiQ+RzWATwfTJqQFw Zkrbtume3dzeEQ9BhkpNTwennel9T6GafvY5JncSKi1XTDOG+fWuusE4kpRMvHk4BQr+ v5dw== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 04/12] linux: Update mips vDSO symbols Date: Thu, 12 Dec 2019 15:16:06 -0300 Message-Id: <20191212181614.31782-4-adhemerval.zanella@linaro.org> In-Reply-To: <20191212181614.31782-1-adhemerval.zanella@linaro.org> References: <20191212181614.31782-1-adhemerval.zanella@linaro.org> The clock_getres is a new implementation added on Linux 5.4 (abed3d826f2f). Checked with a build against mips-linux-gnu and mips64-linux-gnu. --- sysdeps/unix/sysv/linux/mips/sysdep.h | 1 + 1 file changed, 1 insertion(+) -- 2.17.1 diff --git a/sysdeps/unix/sysv/linux/mips/sysdep.h b/sysdeps/unix/sysv/linux/mips/sysdep.h index 2470f32d58..defad8eb62 100644 --- a/sysdeps/unix/sysv/linux/mips/sysdep.h +++ b/sysdeps/unix/sysv/linux/mips/sysdep.h @@ -22,3 +22,4 @@ /* List of system calls which are supported as vsyscalls. */ #define HAVE_CLOCK_GETTIME_VSYSCALL "__vdso_clock_gettime" #define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday" +#define HAVE_CLOCK_GETRES_VSYSCALL "__vdso_clock_getres" From patchwork Thu Dec 12 18:16:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 181507 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp1118422och; Thu, 12 Dec 2019 10:17:28 -0800 (PST) X-Google-Smtp-Source: APXvYqy2rZVDHqVjPP/twHcvvE5B/dBl83c9EDby2NU1XF3wHeBzofa29OJfPflZ4LAU9aiHKIM1 X-Received: by 2002:a9d:7393:: with SMTP id j19mr9312188otk.336.1576174648282; Thu, 12 Dec 2019 10:17:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576174648; cv=none; d=google.com; s=arc-20160816; b=D8rBDEjdsNS+EoreGHpSmPnqwMqkfSfWEKS+haAS8ydJFGvW0tpM1QywoTK1l5JyPe 4HcMTg0IkSkWtLBA+qF9JBABrU73rsmuCacFkbkhjxE/IVxgKk1ZlLvHggtNMYnGyd+C 4ZjOc879TVMlz6n74+R6MI1jL7PiSlJu69JB+RhK4yseBBxxeTwaX32Pdv/0MfsWa7ZP q05GLqrU95urb0uu/k44I/eILHcK860HeZ5mzqChitxPrtjLQ/YfRRguqHaGHU56S4QX N3nJ0BPjHriAt2RVoVa97SHflK+cm/6vMjgP4lHQWDGOsMvot1kHGGxR38nsRygoyT3f KWFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=gOXzOviMky7jSLkvY7KfqCXxD+bwH8eAZo8h6YWtCbE=; b=iGZzLKFpnZNlJSw5lLPxVPYDnmgkFyKh082InPs57JT+FW6/U8MVs8TRe3oRqtQnff H55ge0MjAiJBCcnmZI08MwZtniXk/x8a0WaUOB19uUVgBRF8eNVezV2JXe7xNCR05Olb 8JIS49G6eRWNUyGE18hoGd74g09gRi5r1jag7wp4cnzCiF7toSA/lCDjw28zVGpWito7 LZdZ5eV/0U6mqYe/4QUXLlCzStVtOntcbWkwzJ0UixR7W2L1t+8pJLOuq2mqDND0to1c PCazKr3yxT1pkkMKR5VIecn9CvtWdxrufQDqRvse+4uf40ixoxuXY4eqOmhb/3E2poJO KcMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=gAySxwt2; dkim=pass header.i=@linaro.org header.s=google header.b=DOX44jUv; spf=pass (google.com: domain of libc-alpha-return-108019-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-108019-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id v18si3898853oic.27.2019.12.12.10.17.28 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Dec 2019 10:17:28 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-108019-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=gAySxwt2; dkim=pass header.i=@linaro.org header.s=google header.b=DOX44jUv; spf=pass (google.com: domain of libc-alpha-return-108019-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-108019-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=dsdCPZHFDpI3zyFHuSpjXogFkk1cZRa 5seGa65Tn1ggr4oP+7GxdY8p/NwOfbt49P5nt2iuevK/jmzstl4/TdZpRWJ9IDQM BGPpbXIY/48uftrAafiqZwD/p4Gd/Aae3T9z0tecrdaPdgl8MMgO4NPiFr4WklF4 UyMBqYwR8jwc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=EEPjI1DuT5djOl42TqUsxKG4jKc=; b=gAySx wt24t3nubfjAnuwJnvjqC6OtZ8D+jQPOib3Uz75yVooXeVy12385cqqantY1NGcg Exeh2YW7QszWzU3vWR/FX4gbGtxQvBmxYepGfKVU208QVh4392cfvHvgvuoNXX1S GXD78ojCwxRv5OVnjUu6HtrRHb4dEYt+DGw/Zw= Received: (qmail 43997 invoked by alias); 12 Dec 2019 18:16:30 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 43882 invoked by uid 89); 12 Dec 2019 18:16:30 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=o, sk:shared-, HX-Received:72d0 X-HELO: mail-ua1-f53.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=gOXzOviMky7jSLkvY7KfqCXxD+bwH8eAZo8h6YWtCbE=; b=DOX44jUvGEcBoaNHHOwFY+/MRwxc6S8BwvofgGM0mWGiqCJINgtUEHYrc+Rib1bcp/ A8Ak3gMhDPYbNozI6mDT/MGfjFoHrZu08pjaeiMCi3/uqfQHMPrjtnqcf6py4Hcjz5CV cVJtF9tlJA8TamX631qNaxFEos8uyVRpFpbrnt/m4O1CSmCAVSltqhQSquYgdwi07N03 sFB3ecjXT4RXv2pgypM38rlWW4cKdjOaLr7vjUIzpuMLuR+GfuwAV/ZUcl7C8XdV4afG CnBWk4LLLC2a4SEqX6yZ6nvRm/WmzA1CFSVnUdSZlkhY9Xs/mvipxTAjK+UphfQJ1jkS 0ORg== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 05/12] Remove vDSO support from make-syscall.sh Date: Thu, 12 Dec 2019 15:16:07 -0300 Message-Id: <20191212181614.31782-5-adhemerval.zanella@linaro.org> In-Reply-To: <20191212181614.31782-1-adhemerval.zanella@linaro.org> References: <20191212181614.31782-1-adhemerval.zanella@linaro.org> The auto-generated vDSO call show some issues: - It requires sync the auto-generated C file with current glibc implementation; - It still uses still uses symbol redirections hacks where libc-symbols.h provide macros that uses compiler builtins (libc_ifunc_redirected for instance); - It does not handle all required compiler handling (inhibit_stack_protector on iFUNC resolver). - It does not have any usage currently. Checked with a build against all major ABIs. --- sysdeps/unix/make-syscalls.sh | 45 +---------------------------------- 1 file changed, 1 insertion(+), 44 deletions(-) -- 2.17.1 diff --git a/sysdeps/unix/make-syscalls.sh b/sysdeps/unix/make-syscalls.sh index fe24bbc78f..c07626677f 100644 --- a/sysdeps/unix/make-syscalls.sh +++ b/sysdeps/unix/make-syscalls.sh @@ -149,14 +149,6 @@ emit_weak_aliases() echo "$calls" | while read file srcfile caller syscall args strong weak; do - vdso_syscall= - case x"$syscall" in - *:*@*) - vdso_syscall="${syscall#*:}" - syscall="${syscall%:*}" - ;; - esac - case x"$syscall" in x-) callnum=_ ;; *) @@ -233,10 +225,9 @@ while read file srcfile caller syscall args strong weak; do if test $shared_only = t; then # The versioned symbols are only in the shared library. echo "shared-only-routines += $file" - test -n "$vdso_syscall" || echo "\$(objpfx)${file}.os: \\" + echo "\$(objpfx)${file}.os: \\" else object_suffixes='$(object-suffixes)' - test -z "$vdso_syscall" || object_suffixes='$(object-suffixes-noshared)' echo "\ \$(foreach p,\$(sysd-rules-targets),\ \$(foreach o,${object_suffixes},\$(objpfx)\$(patsubst %,\$p,$file)\$o)): \\" @@ -268,40 +259,6 @@ while read file srcfile caller syscall args strong weak; do echo ' ) | $(compile-syscall) '"\ \$(foreach p,\$(patsubst %$file,%,\$(basename \$(@F))),\$(\$(p)CPPFLAGS))" - if test -n "$vdso_syscall"; then - # In the shared library, we're going to emit an IFUNC using a vDSO function. - # $vdso_syscall looks like "name@KERNEL_X.Y" where "name" is the symbol - # name in the vDSO and KERNEL_X.Y is its symbol version. - vdso_symbol="${vdso_syscall%@*}" - vdso_symver="${vdso_syscall#*@}" - vdso_symver=`echo "$vdso_symver" | sed 's/\./_/g'` - cat <'; \\ - echo '#undef ${strong}'; \\ - echo '#define vdso_ifunc_init()'; \\ - echo '__ifunc (__redirect_${strong}, ${strong},'; \\ - echo ' get_vdso_symbol ("${vdso_symbol}"), void,'; \\ - echo ' vdso_ifunc_init)'; \\ -EOF - # This is doing "hidden_def (${strong})", but the compiler - # doesn't know that we've defined ${strong} in the same file, so - # we can't do it the normal way. - cat < X-Patchwork-Id: 181508 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp1118649och; Thu, 12 Dec 2019 10:17:39 -0800 (PST) X-Google-Smtp-Source: APXvYqwgWkq8UImiDaMkzM4ehKCRGjV4wIUfg6pEjf4ltgKbOq195AknUjYlkGJent48hvBXKkuo X-Received: by 2002:a9d:7f02:: with SMTP id j2mr9426454otq.123.1576174659351; Thu, 12 Dec 2019 10:17:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576174659; cv=none; d=google.com; s=arc-20160816; b=VReeyWDSwydw0k0AgMLp34V75zyHp5S/z+bMNwB/h/rmtiLfGLrmQi+5mDTGERMRa0 thgsQeTFk2mdqfxec8i1VSzDelSfArjpg9ZXo/Xw0YoxSzkyZ+n4EGAoDLDyMlauQ7iV uCK/7job1l/ytVDsPmKpKar1nv/XRyhk0hBEYz3cmITLdgUKAX3KLDEa7Qg1GhCtlvTW lcvd8u8I9tUTu6ijNhq9e3h5VvfDD5S+E9bwFpjLY/zrpVsVfgYCHiAWvPhupnX0xYrw +dKBTRF23l6GpIBfGNhbHIAidFoJhxusNGW0E0PmAGPJllPvgYAP8CtKtlg+Iref4Ps2 spdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=3lWEW69jYpbijebuOLoPtSyD04JBUkeMOMByuWuzlTM=; b=R4dHyviKxG60UOR+EUTeEqMQs8ASrRhteq7NLWaZnpqaY/riHvzCQcwEc2tdWPa/hS iC42WfWwEB3pryN4m9CVo8lyo8F0OI9ZBi2j1sYNyvFtVNZ2uKyojPKLmze+PdQ3kvWn lEnZyXF/mhjJVLuu8ezDqpD3iDQ71CW3dRj5mI6JQbrlyTQ/9qvWGYKtaITw/0KITOSk roQmRYDUScRy/xjKfKxdzhuDJR80b6bG/atVMzaX9nr5cS47NAxugvqDm6pDp8W5pEap X48p0PJlvTayPKTE692fxPN4IresNmm0ly3Hgd0xaYlcFXMmDAbQm9pBOmWcfn0w8Ffz c+2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=t7mWz2LJ; dkim=pass header.i=@linaro.org header.s=google header.b=ytIt46aB; spf=pass (google.com: domain of libc-alpha-return-108020-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-108020-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id q25si3522381otc.115.2019.12.12.10.17.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Dec 2019 10:17:39 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-108020-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=t7mWz2LJ; dkim=pass header.i=@linaro.org header.s=google header.b=ytIt46aB; spf=pass (google.com: domain of libc-alpha-return-108020-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-108020-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=Up9N+WrPeTtqpQ7vTwOTTg5NWW1cD0l 0fJXc+wYWVQwwSO7zbTCvGOUvLhjNhbNZCivnYwW0r9SXxVHrwD5Bk7vZOJq6Hec ZIiu+qSI2S7rJ/7AHr92dJIhWjgqjqAFhM3QlZd6eLrtx041G89+IVNuWSoY1hTs UiA9v/EguZc0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=OmPpXrmOE+0ZbDaM8+V2sXhH/yU=; b=t7mWz 2LJ2dLlvOB3wRy9/EEa3OSJXZSU2fsPdDwlM704aacrSNKm2SP493aSq362leQDt ryFVmapR1tz3Yn2l90rxOZmDDT9Oxp0qRLirOcD8NdkkfSTIMer+FbAltlA8oqZ4 ntFdGTaWd5D9laRuBvDxG2RM5rF4cOu2wY48So= Received: (qmail 44543 invoked by alias); 12 Dec 2019 18:16:34 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 44432 invoked by uid 89); 12 Dec 2019 18:16:33 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=telling, UD:ro X-HELO: mail-vk1-f181.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=3lWEW69jYpbijebuOLoPtSyD04JBUkeMOMByuWuzlTM=; b=ytIt46aBngUilsbfOvaNYpcpz39rhMi5UdfTp77wUZaDVw5eaoE1FIoThgXb0tZ+1n 8CRy36gbC8USijyA6cj09w27lVC6aPdJV8Kmxq8EKMfSwqr0vXNtp7awPx5KKLsUK9pP v2g6QHin5VMuRXjA7DjKqiVKeCqZFg2Qerio3xsDC2riw89iCyGYFdpMuYcedVVTCNss M+c/KWXxD1tdyP/YGpGCL4shXwnkI5TrjfdgXcy7UIVWziWIBtQNlDD+7beP1RjgdICu OLXKPnadt825dV5qykaMohSc0lM5IEYlpThD1EIOuqP0HpdAA8etkvr9j30jwZPCqUzk 1uxw== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH v2 06/12] elf: Enable relro for static build Date: Thu, 12 Dec 2019 15:16:08 -0300 Message-Id: <20191212181614.31782-6-adhemerval.zanella@linaro.org> In-Reply-To: <20191212181614.31782-1-adhemerval.zanella@linaro.org> References: <20191212181614.31782-1-adhemerval.zanella@linaro.org> Changes from previous version: - Added tests for partial and full relro. -- The code is similar to the one at elf/dl-reloc.c, where it checks for the l_relro_size from the link_map (obtained from PT_GNU_RELRO header from program headers) and calls_dl_protected_relro. Checked on x86_64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu, aarch64-linux-gnu, s390x-linux-gnu, and sparc64-linux-gnu. I also check with --enable-static pie on x86_64-linux-gnu, i686-linux-gnu, and aarch64-linux-gnu which seems the only architectures where static PIE is actually working (as per 9d7a3741c9e, on arm-linux-gnueabihf, powerpc64{le}-linux-gnu, and s390x-linux-gnu I am seeing runtime issues not related to my patch). --- elf/Makefile | 11 +++++++-- elf/dl-support.c | 18 +++++++++++--- elf/tst-data-relro-lazy-static.c | 1 + elf/tst-data-relro-lazy.c | 1 + elf/tst-data-relro-now-static.c | 1 + elf/tst-data-relro-now.c | 1 + elf/tst-data-relro.c | 42 ++++++++++++++++++++++++++++++++ 7 files changed, 69 insertions(+), 6 deletions(-) create mode 100644 elf/tst-data-relro-lazy-static.c create mode 100644 elf/tst-data-relro-lazy.c create mode 100644 elf/tst-data-relro-now-static.c create mode 100644 elf/tst-data-relro-now.c create mode 100644 elf/tst-data-relro.c -- 2.17.1 diff --git a/elf/Makefile b/elf/Makefile index b2b3be203f..45b5ad4ea6 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -154,7 +154,8 @@ endif tests-static-normal := tst-leaks1-static tst-array1-static tst-array5-static \ tst-dl-iter-static \ tst-tlsalign-static tst-tlsalign-extern-static \ - tst-linkall-static tst-env-setuid tst-env-setuid-tunables + tst-linkall-static tst-env-setuid tst-env-setuid-tunables \ + tst-data-relro-lazy-static tst-data-relro-now-static tests-static-internal := tst-tls1-static tst-tls2-static \ tst-ptrguard1-static tst-stackguard1-static \ tst-tls1-static-non-pie tst-libc_dlvsym-static @@ -205,7 +206,8 @@ tests-internal += loadtest unload unload2 circleload1 \ neededtest neededtest2 neededtest3 neededtest4 \ tst-tls3 tst-tls6 tst-tls7 tst-tls8 tst-dlmopen2 \ tst-ptrguard1 tst-stackguard1 tst-libc_dlvsym \ - tst-create_format1 + tst-create_format1 \ + tst-data-relro-now tst-data-relro-lazy tests-container += tst-pldd tst-dlopen-tlsmodid-container \ tst-dlopen-self-container test-srcs = tst-pathopt @@ -1627,3 +1629,8 @@ $(objpfx)tst-dlopenfailmod1.so: \ $(shared-thread-library) $(objpfx)tst-dlopenfaillinkmod.so LDFLAGS-tst-dlopenfaillinkmod.so = -Wl,-soname,tst-dlopenfail-missingmod.so $(objpfx)tst-dlopenfailmod2.so: $(shared-thread-library) + +LDFLAGS-tst-data-relro-lazy += -Wl,-z,relro -Wl,-z,lazy +LDFLAGS-tst-data-relro-lazy-static += -Wl,-z,relro -Wl,-z,lazy +LDFLAGS-tst-data-relro-now += -Wl,-z,relro -Wl,-z,now +LDFLAGS-tst-data-relro-now-static += -Wl,-z,relro -Wl,-z,now diff --git a/elf/dl-support.c b/elf/dl-support.c index 5526d5ee6e..b2b1b12f6f 100644 --- a/elf/dl-support.c +++ b/elf/dl-support.c @@ -367,14 +367,24 @@ _dl_non_dynamic_init (void) if (_dl_platform != NULL) _dl_platformlen = strlen (_dl_platform); - /* Scan for a program header telling us the stack is nonexecutable. */ if (_dl_phdr != NULL) - for (uint_fast16_t i = 0; i < _dl_phnum; ++i) - if (_dl_phdr[i].p_type == PT_GNU_STACK) + for (const ElfW(Phdr) *ph = _dl_phdr; ph < &_dl_phdr[_dl_phnum]; ++ph) + switch (ph->p_type) { - _dl_stack_flags = _dl_phdr[i].p_flags; + /* Check if the stack is nonexecutable. */ + case PT_GNU_STACK: + _dl_stack_flags = ph->p_flags; + break; + + case PT_GNU_RELRO: + _dl_main_map.l_relro_addr = ph->p_vaddr; + _dl_main_map.l_relro_size = ph->p_memsz; break; } + + /* Setup relro on the binary itself. */ + if (_dl_main_map.l_relro_size != 0) + _dl_protect_relro (&_dl_main_map); } #ifdef DL_SYSINFO_IMPLEMENTATION diff --git a/elf/tst-data-relro-lazy-static.c b/elf/tst-data-relro-lazy-static.c new file mode 100644 index 0000000000..364a206506 --- /dev/null +++ b/elf/tst-data-relro-lazy-static.c @@ -0,0 +1 @@ +#include diff --git a/elf/tst-data-relro-lazy.c b/elf/tst-data-relro-lazy.c new file mode 100644 index 0000000000..364a206506 --- /dev/null +++ b/elf/tst-data-relro-lazy.c @@ -0,0 +1 @@ +#include diff --git a/elf/tst-data-relro-now-static.c b/elf/tst-data-relro-now-static.c new file mode 100644 index 0000000000..364a206506 --- /dev/null +++ b/elf/tst-data-relro-now-static.c @@ -0,0 +1 @@ +#include diff --git a/elf/tst-data-relro-now.c b/elf/tst-data-relro-now.c new file mode 100644 index 0000000000..364a206506 --- /dev/null +++ b/elf/tst-data-relro-now.c @@ -0,0 +1 @@ +#include diff --git a/elf/tst-data-relro.c b/elf/tst-data-relro.c new file mode 100644 index 0000000000..bd63b24b3f --- /dev/null +++ b/elf/tst-data-relro.c @@ -0,0 +1,42 @@ +/* Test if variables places on relro section are not writable. + Copyright (C) 2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +#include +#include + +static volatile int val __attribute__ ((section (".data.rel.ro"))); + +static void +callback (void *closure) +{ + /* It should trigger an invalid write. */ + val = 1; +} + +int do_test (void) +{ + struct support_capture_subprocess result + = support_capture_subprocess (callback, NULL); + support_capture_subprocess_check (&result, "tst-relro", -SIGSEGV, + sc_allow_stdout); + return 0; +} + +#include From patchwork Thu Dec 12 18:16:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 181514 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp1119868och; Thu, 12 Dec 2019 10:18:44 -0800 (PST) X-Google-Smtp-Source: APXvYqzMgzltBD/7ZbStyxbcRbUqTVXtFHW1md0uC/G/9T2kME//RPkEt+/xJBn+Ma+m/GLCc40w X-Received: by 2002:a9d:61c4:: with SMTP id h4mr10084327otk.310.1576174724530; Thu, 12 Dec 2019 10:18:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576174724; cv=none; d=google.com; s=arc-20160816; b=rFNP54Z2+1HP9UbC7bsFofPA4EGvP4iu+ThkgRY4bzhIXlSEFgD4qKQoq89hUFN9WT 5GHSGlZNYXQgKN1ZwRuIxa5x/oB6eWWMJ7xWqesRoggQCZTicKCTl1bTNjDFNxTC3GIH ZnLiNwujHQXG4OBMd/xq4qUqnVr1r0rmVlTUjpoKU3wD2lWiU6ktWVqe90vjQhos++mp f5c3Wm5Kmz8ZXUBpb2mwILQIVmkjI//XncbU4z7k962E3nNJGKpTjCJa0CM7VRceWFO9 MAqhBTQD0oxmSJkhiSL9hJCO59u7gvRTCoPnCj4RQf3M7P1HxO4Rjhu4OCvkxZza9H60 Y5iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=RMfwFfyTPqhfWU0wUaSXXsmFcpAPwuyO6N+KjNHNQNs=; b=JXukpuL7w9jXYnE3Mrc4rA4ryqVsnBK4U7vzdOxbo6FpvIrGkIn4OdTlrycidLP2ho n/ITpQZ+FoRUh8Ql/bvSE6DHZEMxm3L75yStb1+lTbh/Cnap+QImx8rbZs9dVGhlIiQH Qsg8bszrHTJ9Yloyj8gAX3piznYkJhGqTvr/REigs3OnsiDhI0U2VljVKDoD5mLZuPJG WvpSpoAVlW08A7pPiCLBcEBUE1YJDCrjr6kSjAsBba7B7NZtYzSpkW8S4XzP3otKFhKX JVBhFLk2jmTa+iYnhgQho5Ikqf5NnCQIK1iaDOW0NojMQlYOVwlll+KTPVDyeMvAf4Hi SIGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=afucPnr3; dkim=pass header.i=@linaro.org header.s=google header.b=O5JUwCkK; spf=pass (google.com: domain of libc-alpha-return-108026-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-108026-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id g10si3422882otn.12.2019.12.12.10.18.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Dec 2019 10:18:44 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-108026-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=afucPnr3; dkim=pass header.i=@linaro.org header.s=google header.b=O5JUwCkK; spf=pass (google.com: domain of libc-alpha-return-108026-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-108026-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=ceBnN1D0Ft6FjotLJK8jA4CkBwVITPR /oknnzX7xYlb85AcTeOVONt+3cvWkpfyKKnP+A7NNINrnOkRlCtjMw/CIY0xsbR1 wR36i9XOoq07cE+gw0P2l/qW9AU28/X51Rp/2cRELBlLlvRu4t7PAGhcowuQpnPj RGbHVagM63x4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=ZvKI7zN2JGPsAIbGxiP5scMyjJ8=; b=afucP nr3YScJSCmAM16invkV0041d9Pq5XYspsdAAOLH4El+IKymO+4nGTy+72X9S84VK NGNUSYW4hopTl4sJfvOx5edHS+uXeXe42xgbrxYKQs48R+FPZT5GMoVIVjAwBNSH vSjWA15jbE6hZlG1uaz8RdcSb6tTP8xDal8qk8= Received: (qmail 47858 invoked by alias); 12 Dec 2019 18:16:57 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 45940 invoked by uid 89); 12 Dec 2019 18:16:43 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=vers, csu X-HELO: mail-vk1-f174.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=RMfwFfyTPqhfWU0wUaSXXsmFcpAPwuyO6N+KjNHNQNs=; b=O5JUwCkKPYOs2FkG3y9Oh6aJ5FOrhypYTyNzt0ZRc8shD1vE4q2hDM5jrOVk+Kinc3 jtqsJ7VnpWG/l0BALIPAvqdbEkOk6FFOzqKZScOFUe0OIZTQOcEwfhR0IQvlamNglZNz VcvMBtwRo2RY+beraYWCQmdZ6uGijYgFsDxI94IWjpSAPbCVYgQeG/ai4b6+2eTfd5Do b48uCj7pRz8zaCPI+U8pjBsnYFRuvuL/IjVYCms0tfSJ0jElotcAARpWRCREUFMO0WNp f0/vPbqf59jDSrpl4nwz7z2EeEP977n1ZMU7vV27Zfl+4M1p7oL11Z+ETWNsDAnWMUPK YZlA== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH v2 07/12] elf: Move vDSO setup to rtld (BZ#24967) Date: Thu, 12 Dec 2019 15:16:09 -0300 Message-Id: <20191212181614.31782-7-adhemerval.zanella@linaro.org> In-Reply-To: <20191212181614.31782-1-adhemerval.zanella@linaro.org> References: <20191212181614.31782-1-adhemerval.zanella@linaro.org> Changes from previous version: - Simplified the patch by moving the HAVE_VSYSCALL removal refactor to its own patch. -- This patch moves the vDSO setup from libc to loader code, just after the vDSO link_map setup. For static case the initialization is moved to _dl_non_dynamic_init instead. Instead of using the mangled pointer, the vDSO data is set as attribute_relro (on _rtld_global_ro for shared or _dl_vdso_* for static). It is read-only even with partial relro. It also fixes BZ#24967 now that the vDSO pointer is setup earlier than malloc interposition is called. Checked on x86_64-linux-gnu, i686-linux-gnu, aarch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu, powerpc64-linux-gnu, powerpc-linux-gnu, s390x-linux-gnu, sparc64-linux-gnu, and sparcv9-linux-gnu. I also run some tests on mips. --- csu/init-first.c | 4 - elf/dl-support.c | 7 ++ elf/rtld.c | 7 +- malloc/tst-interpose-aux.c | 5 ++ sysdeps/generic/dl-vdso-setup.c | 1 + sysdeps/generic/dl-vdso-setup.h | 28 ++++++ sysdeps/generic/dl-vdso.h | 30 +++++++ sysdeps/generic/ldsodefs.h | 6 ++ sysdeps/powerpc/powerpc32/backtrace.c | 16 ++-- sysdeps/powerpc/powerpc64/backtrace.c | 8 +- sysdeps/unix/sysv/linux/aarch64/Makefile | 1 - .../unix/sysv/linux/aarch64/gettimeofday.c | 5 +- sysdeps/unix/sysv/linux/arm/Makefile | 1 - sysdeps/unix/sysv/linux/dl-vdso-setup.c | 81 +++++++++++++++++ sysdeps/unix/sysv/linux/dl-vdso-setup.h | 55 ++++++++++++ sysdeps/unix/sysv/linux/dl-vdso.c | 48 ---------- sysdeps/unix/sysv/linux/dl-vdso.h | 30 ++++--- sysdeps/unix/sysv/linux/init-first.c | 90 ------------------- sysdeps/unix/sysv/linux/libc-vdso.h | 55 ------------ sysdeps/unix/sysv/linux/mips/Makefile | 2 - sysdeps/unix/sysv/linux/powerpc/Makefile | 1 - .../sysv/linux/powerpc/get_timebase_freq.c | 12 ++- .../unix/sysv/linux/powerpc/gettimeofday.c | 15 ++-- sysdeps/unix/sysv/linux/powerpc/init-first.c | 50 ----------- sysdeps/unix/sysv/linux/powerpc/libc-vdso.h | 10 --- sysdeps/unix/sysv/linux/powerpc/time.c | 17 ++-- sysdeps/unix/sysv/linux/riscv/Makefile | 4 - sysdeps/unix/sysv/linux/riscv/flush-icache.c | 2 +- sysdeps/unix/sysv/linux/s390/Makefile | 4 - sysdeps/unix/sysv/linux/sparc/Makefile | 4 - sysdeps/unix/sysv/linux/sysdep-vdso.h | 11 +-- sysdeps/unix/sysv/linux/x86/Makefile | 4 - sysdeps/unix/sysv/linux/x86/gettimeofday.c | 5 +- sysdeps/unix/sysv/linux/x86/time.c | 5 +- 34 files changed, 271 insertions(+), 353 deletions(-) create mode 100644 sysdeps/generic/dl-vdso-setup.c create mode 100644 sysdeps/generic/dl-vdso-setup.h create mode 100644 sysdeps/generic/dl-vdso.h create mode 100644 sysdeps/unix/sysv/linux/dl-vdso-setup.c create mode 100644 sysdeps/unix/sysv/linux/dl-vdso-setup.h delete mode 100644 sysdeps/unix/sysv/linux/dl-vdso.c delete mode 100644 sysdeps/unix/sysv/linux/init-first.c delete mode 100644 sysdeps/unix/sysv/linux/libc-vdso.h delete mode 100644 sysdeps/unix/sysv/linux/powerpc/init-first.c -- 2.17.1 diff --git a/csu/init-first.c b/csu/init-first.c index e0f489ee6d..891719a839 100644 --- a/csu/init-first.c +++ b/csu/init-first.c @@ -74,10 +74,6 @@ _init (int argc, char **argv, char **envp) _dl_non_dynamic_init (); #endif -#ifdef VDSO_SETUP - VDSO_SETUP (); -#endif - __init_misc (argc, argv, envp); /* Initialize ctype data. */ diff --git a/elf/dl-support.c b/elf/dl-support.c index b2b1b12f6f..81d44b0343 100644 --- a/elf/dl-support.c +++ b/elf/dl-support.c @@ -34,6 +34,8 @@ #include #include #include +#include +#include extern char *__progname; char **_dl_argv = &__progname; /* This is checked for some error messages. */ @@ -201,6 +203,8 @@ struct link_map *_dl_sysinfo_map; # include "get-dynamic-info.h" #endif #include "setup-vdso.h" +/* Define the vDSO function pointers. */ +#include /* During the program run we must not modify the global data of loaded shared object simultanously in two threads. Therefore we @@ -315,6 +319,9 @@ _dl_non_dynamic_init (void) so they can influence _dl_init_paths. */ setup_vdso (NULL, NULL); + /* With vDSO setup we can initialize the function pointers. */ + setup_vdso_pointers (); + /* Initialize the data structures for the search paths for shared objects. */ _dl_init_paths (getenv ("LD_LIBRARY_PATH")); diff --git a/elf/rtld.c b/elf/rtld.c index dd8fc5e6c6..a06e13c657 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -39,6 +39,8 @@ #include #include #include +#include +#include #include #include #include @@ -833,7 +835,7 @@ security_init (void) _dl_random = NULL; } -#include "setup-vdso.h" +#include /* The library search path. */ static const char *library_path attribute_relro; @@ -1538,6 +1540,9 @@ ERROR: '%s': cannot process note segment.\n", _dl_argv[0]); so they can influence _dl_init_paths. */ setup_vdso (main_map, &first_preload); + /* With vDSO setup we can initialize the function pointers. */ + setup_vdso_pointers (); + #ifdef DL_SYSDEP_OSCHECK DL_SYSDEP_OSCHECK (_dl_fatal_printf); #endif diff --git a/malloc/tst-interpose-aux.c b/malloc/tst-interpose-aux.c index bbe321e843..8cbc3e6fea 100644 --- a/malloc/tst-interpose-aux.c +++ b/malloc/tst-interpose-aux.c @@ -28,6 +28,7 @@ #include #include #include +#include #if INTERPOSE_THREADS #include @@ -96,6 +97,7 @@ struct __attribute__ ((aligned (__alignof__ (max_align_t)))) allocation_header { size_t allocation_index; size_t allocation_size; + struct timespec ts; }; /* Array of known allocations, to track invalid frees. */ @@ -166,6 +168,9 @@ malloc_internal (size_t size) .allocation_index = index, .allocation_size = allocation_size }; + /* BZ#24967: Check if calling a symbol which may use the vDSO does not fail. + The CLOCK_REALTIME should be supported on all systems. */ + clock_gettime (CLOCK_REALTIME, &allocations[index]->ts); return allocations[index] + 1; } diff --git a/sysdeps/generic/dl-vdso-setup.c b/sysdeps/generic/dl-vdso-setup.c new file mode 100644 index 0000000000..6e25b021ab --- /dev/null +++ b/sysdeps/generic/dl-vdso-setup.c @@ -0,0 +1 @@ +/* Empty. */ diff --git a/sysdeps/generic/dl-vdso-setup.h b/sysdeps/generic/dl-vdso-setup.h new file mode 100644 index 0000000000..3d79bae317 --- /dev/null +++ b/sysdeps/generic/dl-vdso-setup.h @@ -0,0 +1,28 @@ +/* ELF symbol initialization functions for VDSO objects. + Copyright (C) 2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _DL_VDSO_INIT_H +#define _DL_VDSO_INIT_H + +/* Initialize the VDSO functions pointers. */ +static inline void __attribute__ ((always_inline)) +setup_vdso_pointers (void) +{ +} + +#endif diff --git a/sysdeps/generic/dl-vdso.h b/sysdeps/generic/dl-vdso.h new file mode 100644 index 0000000000..5651f49a1a --- /dev/null +++ b/sysdeps/generic/dl-vdso.h @@ -0,0 +1,30 @@ +/* ELF symbol resolve functions for VDSO objects. + Copyright (C) 2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _DL_VDSO_H +#define _DL_VDSO_H 1 + +/* Function for resolving symbols in the VDSO link map. Return the + address of the vdso symbol NAME. */ +static inline void * +dl_vdso_vsym (const char *name) +{ + return NULL; +} + +#endif diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index fc25a81e1c..8cbd0e87cc 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -608,6 +608,12 @@ struct rtld_global_ro /* At startup time we set up the normal DSO data structure for it, and this points to it. */ EXTERN struct link_map *_dl_sysinfo_map; + +# define PROCINFO_DECL +# ifndef PROCINFO_CLASS +# define PROCINFO_CLASS EXTERN +# endif +# include #endif /* Mask for more hardware capabilities that are available on some diff --git a/sysdeps/powerpc/powerpc32/backtrace.c b/sysdeps/powerpc/powerpc32/backtrace.c index 2e6a859d9f..f2a57480a5 100644 --- a/sysdeps/powerpc/powerpc32/backtrace.c +++ b/sysdeps/powerpc/powerpc32/backtrace.c @@ -51,14 +51,14 @@ struct signal_frame_32 { /* We don't care about the rest, since IP value is at 'mctx' field. */ }; -static inline int +static inline bool is_sigtramp_address (void *nip) { #ifdef HAVE_SIGTRAMP_RT32 - if (nip == VDSO_SYMBOL (sigtramp32)) - return 1; + if (nip == GLRO (dl_vdso_sigtramp_32)) + return true; #endif - return 0; + return false; } struct rt_signal_frame_32 { @@ -68,14 +68,14 @@ struct rt_signal_frame_32 { /* We don't care about the rest, since IP value is at 'uc' field. */ }; -static inline int +static inline bool is_sigtramp_address_rt (void * nip) { #ifdef HAVE_SIGTRAMP_32 - if (nip == VDSO_SYMBOL (sigtramp_rt32)) - return 1; + if (nip == GLRO (dl_vdso_sigtramp_rt32)) + return true; #endif - return 0; + return false; } int diff --git a/sysdeps/powerpc/powerpc64/backtrace.c b/sysdeps/powerpc/powerpc64/backtrace.c index 234d9c00dc..8ed5bc1585 100644 --- a/sysdeps/powerpc/powerpc64/backtrace.c +++ b/sysdeps/powerpc/powerpc64/backtrace.c @@ -54,14 +54,14 @@ struct signal_frame_64 { /* We don't care about the rest, since the IP value is at 'uc' field. */ }; -static inline int +static inline bool is_sigtramp_address (void *nip) { #ifdef HAVE_SIGTRAMP_RT64 - if (nip == VDSO_SYMBOL (sigtramp_rt64)) - return 1; + if (nip == GLRO (dl_vdso_sigtramp_rt64)) + return true; #endif - return 0; + return false; } int diff --git a/sysdeps/unix/sysv/linux/aarch64/Makefile b/sysdeps/unix/sysv/linux/aarch64/Makefile index 57bbfeaac6..4bcae85bca 100644 --- a/sysdeps/unix/sysv/linux/aarch64/Makefile +++ b/sysdeps/unix/sysv/linux/aarch64/Makefile @@ -5,7 +5,6 @@ shared-only-routines += libc-__read_tp endif ifeq ($(subdir),elf) -sysdep_routines += dl-vdso sysdep-rtld-routines += __read_tp ifeq ($(build-shared),yes) # This is needed for DSO loading from static binaries. 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 -# include - # define INIT_ARCH() libc_ifunc (__gettimeofday, - (get_vdso_symbol (HAVE_GETTIMEOFDAY_VSYSCALL) + (GLRO(dl_vdso_gettimeofday) ?: __gettimeofday_vsyscall)) #else diff --git a/sysdeps/unix/sysv/linux/arm/Makefile b/sysdeps/unix/sysv/linux/arm/Makefile index d7a2f6a8a7..abdf01f00c 100644 --- a/sysdeps/unix/sysv/linux/arm/Makefile +++ b/sysdeps/unix/sysv/linux/arm/Makefile @@ -1,5 +1,4 @@ ifeq ($(subdir),elf) -sysdep_routines += dl-vdso sysdep-rtld-routines += aeabi_read_tp libc-do-syscall endif diff --git a/sysdeps/unix/sysv/linux/dl-vdso-setup.c b/sysdeps/unix/sysv/linux/dl-vdso-setup.c new file mode 100644 index 0000000000..1069879f1a --- /dev/null +++ b/sysdeps/unix/sysv/linux/dl-vdso-setup.c @@ -0,0 +1,81 @@ +/* Data for vDSO support. Linux version. + Copyright (C) 2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* This file is included in three different modes for both static (libc.a) + and shared (rtld) modes: + + 1. PROCINFO_DECL is defined, meaning we are only interested in + declarations. For static it requires use the extern keywork along with + the attribute_relro while for shared it will be embedded in the + rtld_global_ro. + + 2. PROCINFO_DECL and SHARED are not defined. Nothing to do, the default + zero initializion is suffice. + + 3. PROCINFO_DECL is not defined while SHARED is. Similar to 2., the zero + initialization of rtld_global_ro is suffice. */ + +#ifndef PROCINFO_CLASS +# define PROCINFO_CLASS +#endif + +#ifndef SHARED +# define RELRO attribute_relro +#else +# define RELRO +#endif + +#if defined PROCINFO_DECL || !defined SHARED +# ifdef HAVE_CLOCK_GETTIME_VSYSCALL +PROCINFO_CLASS int (*_dl_vdso_clock_gettime) (clockid_t, + struct timespec *) RELRO; +#endif +# ifdef HAVE_GETTIMEOFDAY_VSYSCALL +PROCINFO_CLASS int (*_dl_vdso_gettimeofday) (struct timeval *, void *) RELRO; +#endif +# ifdef HAVE_TIME_VSYSCALL +PROCINFO_CLASS time_t (*_dl_vdso_time) (time_t *) RELRO; +# endif +# ifdef HAVE_GETCPU_VSYSCALL +PROCINFO_CLASS int (*_dl_vdso_getcpu) (unsigned *, unsigned *, void *) RELRO; +# endif +# ifdef HAVE_CLOCK_GETRES_VSYSCALL +PROCINFO_CLASS int (*_dl_vdso_clock_getres) (clockid_t, + struct timespec *) RELRO; +# endif + +/* PowerPC specific ones. */ +# ifdef HAVE_GET_TBFREQ +PROCINFO_CLASS uint64_t (*_dl_vdso_get_tbfreq)(void) RELRO; +# endif +/* The sigtramp are used on powerpc backtrace without using + INLINE_VSYSCALL, so there is no need to set their type. */ +# ifdef HAVE_SIGTRAMP_RT64 +PROCINFO_CLASS void *_dl_vdso_sigtramp_rt64 RELRO; +# endif +# ifdef HAVE_SIGTRAMP_RT32 +PROCINFO_CLASS void *_dl_vdso_sigtramp_rt32 RELRO; +# endif +# ifdef HAVE_SIGTRAMP_32 +PROCINFO_CLASS void *_dl_vdso_sigtramp_32 RELRO; +# endif +#endif + +#undef RELRO +#undef PROCINFO_DECL +#undef PROCINFO_CLASS diff --git a/sysdeps/unix/sysv/linux/dl-vdso-setup.h b/sysdeps/unix/sysv/linux/dl-vdso-setup.h new file mode 100644 index 0000000000..f4e76202fc --- /dev/null +++ b/sysdeps/unix/sysv/linux/dl-vdso-setup.h @@ -0,0 +1,55 @@ +/* ELF symbol initialization functions for VDSO objects. Linux version. + Copyright (C) 2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _DL_VDSO_INIT_H +#define _DL_VDSO_INIT_H + +/* Initialize the VDSO functions pointers. */ +static inline void __attribute__ ((always_inline)) +setup_vdso_pointers (void) +{ +#ifdef HAVE_CLOCK_GETTIME_VSYSCALL + GLRO(dl_vdso_clock_gettime) = dl_vdso_vsym (HAVE_CLOCK_GETTIME_VSYSCALL); +#endif +#ifdef HAVE_GETTIMEOFDAY_VSYSCALL + GLRO(dl_vdso_gettimeofday) = dl_vdso_vsym (HAVE_GETTIMEOFDAY_VSYSCALL); +#endif +#ifdef HAVE_TIME_VSYSCALL + GLRO(dl_vdso_time) = dl_vdso_vsym (HAVE_TIME_VSYSCALL); +#endif +#ifdef HAVE_GETCPU_VSYSCALL + GLRO(dl_vdso_getcpu) = dl_vdso_vsym (HAVE_GETCPU_VSYSCALL); +#endif +#ifdef HAVE_CLOCK_GETRES_VSYSCALL + GLRO(dl_vdso_clock_getres) = dl_vdso_vsym (HAVE_CLOCK_GETRES_VSYSCALL); +#endif +#ifdef HAVE_GET_TBFREQ + GLRO(dl_vdso_get_tbfreq) = dl_vdso_vsym (HAVE_GET_TBFREQ); +#endif +#ifdef HAVE_SIGTRAMP_RT64 + GLRO(dl_vdso_sigtramp_rt64) = dl_vdso_vsym (HAVE_SIGTRAMP_RT64); +#endif +#ifdef HAVE_SIGTRAMP_RT32 + GLRO(dl_vdso_sigtramp_rt32) = dl_vdso_vsym (HAVE_SIGTRAMP_RT32); +#endif +#ifdef HAVE_SIGTRAMP_32 + GLRO(dl_vdso_sigtramp_32) = dl_vdso_vsym (HAVE_SIGTRAMP_32); +#endif +} + +#endif diff --git a/sysdeps/unix/sysv/linux/dl-vdso.c b/sysdeps/unix/sysv/linux/dl-vdso.c deleted file mode 100644 index 5577f2103c..0000000000 --- a/sysdeps/unix/sysv/linux/dl-vdso.c +++ /dev/null @@ -1,48 +0,0 @@ -/* ELF symbol resolve functions for VDSO objects. - Copyright (C) 2005-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include "config.h" -#include - - -void * -_dl_vdso_vsym (const char *name, const struct r_found_version *vers) -{ - struct link_map *map = GLRO (dl_sysinfo_map); - void *value = NULL; - - - if (map != NULL) - { - /* Use a WEAK REF so we don't error out if the symbol is not found. */ - ElfW (Sym) wsym; - memset (&wsym, 0, sizeof (ElfW (Sym))); - wsym.st_info = (unsigned char) ELFW (ST_INFO (STB_WEAK, STT_NOTYPE)); - - /* Search the scope of the vdso map. */ - const ElfW (Sym) *ref = &wsym; - lookup_t result = GLRO (dl_lookup_symbol_x) (name, map, &ref, - map->l_local_scope, - vers, 0, 0, NULL); - - if (ref != NULL) - value = DL_SYMBOL_ADDRESS (result, ref); - } - - return value; -} diff --git a/sysdeps/unix/sysv/linux/dl-vdso.h b/sysdeps/unix/sysv/linux/dl-vdso.h index 19ffd30c7e..d1e782b81f 100644 --- a/sysdeps/unix/sysv/linux/dl-vdso.h +++ b/sysdeps/unix/sysv/linux/dl-vdso.h @@ -22,11 +22,6 @@ #include #include -/* Functions for resolving symbols in the VDSO link map. */ -extern void *_dl_vdso_vsym (const char *name, - const struct r_found_version *version) - attribute_hidden; - /* If the architecture support vDSO it should define which is the expected kernel version and hash value through both VDSO_NAME and VDSO_HASH (usually defined at architecture sysdep.h). */ @@ -38,19 +33,26 @@ extern void *_dl_vdso_vsym (const char *name, # define VDSO_HASH 0 #endif +/* Functions for resolving symbols in the VDSO link map. */ static inline void * -get_vdso_symbol (const char *symbol) +dl_vdso_vsym (const char *name) { + struct link_map *map = GLRO (dl_sysinfo_map); + if (map == NULL) + return NULL; + + /* Use a WEAK REF so we don't error out if the symbol is not found. */ + ElfW (Sym) wsym = { 0 }; + wsym.st_info = (unsigned char) ELFW (ST_INFO (STB_WEAK, STT_NOTYPE)); + struct r_found_version rfv = { VDSO_NAME, VDSO_HASH, 1, NULL }; - return _dl_vdso_vsym (symbol, &rfv); -} -static inline void * -get_vdso_mangle_symbol (const char *symbol) -{ - void *vdsop = get_vdso_symbol (symbol); - PTR_MANGLE (vdsop); - return vdsop; + /* Search the scope of the vdso map. */ + const ElfW (Sym) *ref = &wsym; + lookup_t result = GLRO (dl_lookup_symbol_x) (name, map, &ref, + map->l_local_scope, + &rfv, 0, 0, NULL); + return ref != NULL ? DL_SYMBOL_ADDRESS (result, ref) : NULL; } #endif /* dl-vdso.h */ diff --git a/sysdeps/unix/sysv/linux/init-first.c b/sysdeps/unix/sysv/linux/init-first.c deleted file mode 100644 index d005d13322..0000000000 --- a/sysdeps/unix/sysv/linux/init-first.c +++ /dev/null @@ -1,90 +0,0 @@ -/* vDSO internal symbols. Linux generic version. - Copyright (C) 2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation; either version 2.1 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include -#include - -/* vDSO symbol used on clock_gettime implementation. */ -#ifdef HAVE_CLOCK_GETTIME_VSYSCALL -int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *) - attribute_hidden; -#endif -/* vDSO symbol used on clock_gettime64 implementation. */ -#ifdef HAVE_CLOCK_GETTIME64_VSYSCALL -int (*VDSO_SYMBOL(clock_gettime64)) (clockid_t, struct __timespec64 *) - attribute_hidden; -#endif -/* vDSO symbol used on clock_getres implementation. */ -#ifdef HAVE_CLOCK_GETRES_VSYSCALL -int (*VDSO_SYMBOL(clock_getres)) (clockid_t, struct timespec *) - attribute_hidden; -#endif -/* vDSO symbol used on gettimeofday implementation. */ -#ifdef HAVE_GETTIMEOFDAY_VSYSCALL -int (*VDSO_SYMBOL (gettimeofday)) (struct timeval *, void *) - attribute_hidden; -#endif -/* vDSO symbol used on GNU extension getcpu implementation. */ -#ifdef HAVE_GETCPU_VSYSCALL -long int (*VDSO_SYMBOL(getcpu)) (unsigned *, unsigned *, void *) - attribute_hidden; -#endif -/* vDSO symbol used on time implementation. */ -#ifdef HAVE_TIME_VSYSCALL -time_t (*VDSO_SYMBOL(time)) (time_t *) attribute_hidden; -#endif - -static inline void -__libc_vdso_platform_setup (void) -{ -#ifdef HAVE_CLOCK_GETTIME_VSYSCALL - VDSO_SYMBOL(clock_gettime) - = get_vdso_mangle_symbol (HAVE_CLOCK_GETTIME_VSYSCALL); -#endif - -#ifdef HAVE_CLOCK_GETTIME64_VSYSCALL - VDSO_SYMBOL(clock_gettime64) - = get_vdso_mangle_symbol (HAVE_CLOCK_GETTIME64_VSYSCALL); -#endif - -#ifdef HAVE_CLOCK_GETRES_VSYSCALL - VDSO_SYMBOL(clock_getres) - = get_vdso_mangle_symbol (HAVE_CLOCK_GETRES_VSYSCALL); -#endif - -#ifdef HAVE_GETTIMEOFDAY_VSYSCALL - VDSO_SYMBOL(gettimeofday) - = get_vdso_mangle_symbol (HAVE_GETTIMEOFDAY_VSYSCALL); -#endif - -#ifdef HAVE_GETCPU_VSYSCALL - VDSO_SYMBOL(getcpu) = get_vdso_mangle_symbol (HAVE_GETCPU_VSYSCALL); -#endif - -#ifdef HAVE_TIME_VSYSCALL - VDSO_SYMBOL(time) = get_vdso_mangle_symbol (HAVE_TIME_VSYSCALL); -#endif - -#ifdef VDSO_SETUP_ARCH - VDSO_SETUP_ARCH (); -#endif -} - -#define VDSO_SETUP __libc_vdso_platform_setup - -#include diff --git a/sysdeps/unix/sysv/linux/libc-vdso.h b/sysdeps/unix/sysv/linux/libc-vdso.h deleted file mode 100644 index c6d505bab3..0000000000 --- a/sysdeps/unix/sysv/linux/libc-vdso.h +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright (C) 2009-2019 Free Software Foundation, Inc. - - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#ifndef _LIBC_VDSO_H -#define _LIBC_VDSO_H - -#define VDSO_SYMBOL(__name) __vdso_##__name - -/* Adjust the return IFUNC value from a vDSO symbol accordingly required - by the ELFv1 ABI. It is used by the architecture to create an ODP - entry since the kernel vDSO does not provide it. */ -#ifndef VDSO_IFUNC_RET -# define VDSO_IFUNC_RET(__value) (__value) -#endif - -#ifdef HAVE_CLOCK_GETTIME_VSYSCALL -extern int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *) - attribute_hidden; -#endif -#ifdef HAVE_CLOCK_GETTIME64_VSYSCALL -extern int (*VDSO_SYMBOL(clock_gettime64)) (clockid_t, struct __timespec64 *) - attribute_hidden; -#endif -#ifdef HAVE_CLOCK_GETRES_VSYSCALL -extern int (*VDSO_SYMBOL(clock_getres)) (clockid_t, struct timespec *) - attribute_hidden; -#endif -#ifdef HAVE_GETTIMEOFDAY_VSYSCALL -extern int (*VDSO_SYMBOL (gettimeofday)) (struct timeval *, void *) - attribute_hidden; -#endif -#ifdef HAVE_GETCPU_VSYSCALL -extern long int (*VDSO_SYMBOL(getcpu)) (unsigned *, unsigned *, void *) - attribute_hidden; -#endif -#ifdef HAVE_TIME_VSYSCALL -extern time_t (*VDSO_SYMBOL(time)) (time_t *) attribute_hidden; -#endif - -#endif /* _LIBC_VDSO_H */ diff --git a/sysdeps/unix/sysv/linux/mips/Makefile b/sysdeps/unix/sysv/linux/mips/Makefile index 03044e7365..026ba242cf 100644 --- a/sysdeps/unix/sysv/linux/mips/Makefile +++ b/sysdeps/unix/sysv/linux/mips/Makefile @@ -60,8 +60,6 @@ ifeq ($(subdir),elf) ifeq ($(build-shared),yes) # This is needed for DSO loading from static binaries. sysdep-dl-routines += dl-static - -sysdep_routines += dl-vdso endif # If the compiler doesn't use GNU.stack note, # this test is expected to fail. diff --git a/sysdeps/unix/sysv/linux/powerpc/Makefile b/sysdeps/unix/sysv/linux/powerpc/Makefile index 1596238afa..cc2f804d86 100644 --- a/sysdeps/unix/sysv/linux/powerpc/Makefile +++ b/sysdeps/unix/sysv/linux/powerpc/Makefile @@ -13,7 +13,6 @@ gen-as-const-headers += ucontext_i.sym endif ifeq ($(subdir),elf) -sysdep_routines += dl-vdso ifeq ($(build-shared),yes) # This is needed for DSO loading from static binaries. sysdep-dl-routines += dl-static diff --git a/sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c b/sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c index 32b9ab5da5..d4afd488f4 100644 --- a/sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c +++ b/sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c @@ -21,7 +21,7 @@ #include #include -#include +#include static uint64_t get_timebase_freq_fallback (void) @@ -101,11 +101,9 @@ uint64_t __get_timebase_freq (void) { /* The vDSO does not have a fallback mechanism (such calling a syscall). */ - __typeof (VDSO_SYMBOL (get_tbfreq)) vdsop = VDSO_SYMBOL (get_tbfreq); - PTR_DEMANGLE (vdsop); - if (vdsop == NULL) - return get_timebase_freq_fallback (); - - return INTERNAL_VSYSCALL_CALL_TYPE (vdsop, uint64_t, 0); + uint64_t (*vdsop) (void) = GLRO(dl_vdso_get_tbfreq); + if (vdsop != NULL) + return INTERNAL_VSYSCALL_CALL_TYPE (vdsop, uint64_t, 0); + return get_timebase_freq_fallback (); } weak_alias (__get_timebase_freq, __ppc_get_timebase_freq) diff --git a/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c b/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c index 1982b1e025..061fa66746 100644 --- a/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c +++ b/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c @@ -18,6 +18,7 @@ #include #include #include +#include static int __gettimeofday_syscall (struct timeval *restrict tv, void *restrict tz) @@ -31,17 +32,11 @@ __gettimeofday_syscall (struct timeval *restrict tv, void *restrict tz) } #ifdef SHARED -# include -# include - -# define INIT_ARCH() \ - void *vdso_gettimeofday = get_vdso_symbol (HAVE_GETTIMEOFDAY_VSYSCALL) - +# define INIT_ARCH() /* If the vDSO is not available we fall back syscall. */ -libc_ifunc (__gettimeofday, - vdso_gettimeofday - ? VDSO_IFUNC_RET (vdso_gettimeofday) - : (void *) __gettimeofday_syscall); +libc_ifunc (__gettimeofday, GLRO(dl_vdso_gettimeofday) + ? VDSO_IFUNC_RET (GLRO(dl_vdso_gettimeofday)) + : (void *) __gettimeofday_syscall); #else int __gettimeofday (struct timeval *restrict tv, void *restrict tz) diff --git a/sysdeps/unix/sysv/linux/powerpc/init-first.c b/sysdeps/unix/sysv/linux/powerpc/init-first.c deleted file mode 100644 index 92a4af83af..0000000000 --- a/sysdeps/unix/sysv/linux/powerpc/init-first.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Initialization code run first thing by the ELF startup code. Linux/PowerPC. - Copyright (C) 2007-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include -#include - -unsigned long long (*VDSO_SYMBOL(get_tbfreq)) (void) attribute_hidden; -#if defined(__PPC64__) || defined(__powerpc64__) -void *VDSO_SYMBOL(sigtramp_rt64) attribute_hidden; -#else -void *VDSO_SYMBOL(sigtramp32) attribute_hidden; -void *VDSO_SYMBOL(sigtramp_rt32) attribute_hidden; -#endif - -static inline void -__libc_vdso_platform_setup_arch (void) -{ - VDSO_SYMBOL (get_tbfreq) = get_vdso_mangle_symbol (HAVE_GET_TBFREQ); - - /* PPC64 uses only one signal trampoline symbol, while PPC32 will use - two depending if SA_SIGINFO is used (__kernel_sigtramp_rt32) or not - (__kernel_sigtramp32). - There is no need to pointer mangle these symbol because they will - used only for pointer comparison. */ -#if defined(__PPC64__) || defined(__powerpc64__) - VDSO_SYMBOL(sigtramp_rt64) = get_vdso_symbol (HAVE_SIGTRAMP_RT64); -#else - VDSO_SYMBOL(sigtramp32) = get_vdso_symbol (HAVE_SIGTRAMP_32); - VDSO_SYMBOL(sigtramp_rt32) = get_vdso_symbol (HAVE_SIGTRAMP_RT32); -#endif -} - -#define VDSO_SETUP_ARCH __libc_vdso_platform_setup_arch - -#include diff --git a/sysdeps/unix/sysv/linux/powerpc/libc-vdso.h b/sysdeps/unix/sysv/linux/powerpc/libc-vdso.h index cb7da3b289..adc06d48b0 100644 --- a/sysdeps/unix/sysv/linux/powerpc/libc-vdso.h +++ b/sysdeps/unix/sysv/linux/powerpc/libc-vdso.h @@ -54,14 +54,4 @@ # define VDSO_IFUNC_RET(value) ((void *) (value)) #endif -#include_next - -extern unsigned long long (*VDSO_SYMBOL(get_tbfreq)) (void); -#if defined(__PPC64__) || defined(__powerpc64__) -extern void *VDSO_SYMBOL(sigtramp_rt64); -#else -extern void *VDSO_SYMBOL(sigtramp32); -extern void *VDSO_SYMBOL(sigtramp_rt32); -#endif - #endif /* _LIBC_VDSO_H */ diff --git a/sysdeps/unix/sysv/linux/powerpc/time.c b/sysdeps/unix/sysv/linux/powerpc/time.c index 2059097c0a..4f90604e6a 100644 --- a/sysdeps/unix/sysv/linux/powerpc/time.c +++ b/sysdeps/unix/sysv/linux/powerpc/time.c @@ -19,6 +19,7 @@ #include #include #include +#include static time_t time_vsyscall (time_t *t) @@ -30,18 +31,12 @@ time_vsyscall (time_t *t) } #ifdef SHARED -# include -# include - -# define INIT_ARCH() \ - void *vdso_time = get_vdso_symbol (HAVE_TIME_VSYSCALL); - +#undef INIT_ARCH +#define INIT_ARCH() /* If the vDSO is not available we fall back to the syscall. */ -libc_ifunc (time, - vdso_time - ? VDSO_IFUNC_RET (vdso_time) - : (void *) time_vsyscall); - +libc_ifunc (time, GLRO(dl_vdso_time) + ? VDSO_IFUNC_RET (GLRO(dl_vdso_time)) + : (void *) time_vsyscall) #else time_t time (time_t *t) diff --git a/sysdeps/unix/sysv/linux/riscv/Makefile b/sysdeps/unix/sysv/linux/riscv/Makefile index b7ad31885c..301b082398 100644 --- a/sysdeps/unix/sysv/linux/riscv/Makefile +++ b/sysdeps/unix/sysv/linux/riscv/Makefile @@ -1,7 +1,3 @@ -ifeq ($(subdir),elf) -sysdep_routines += dl-vdso -endif - ifeq ($(subdir),misc) sysdep_headers += sys/cachectl.h sysdep_routines += flush-icache diff --git a/sysdeps/unix/sysv/linux/riscv/flush-icache.c b/sysdeps/unix/sysv/linux/riscv/flush-icache.c index c5bd60d9c2..e967e40deb 100644 --- a/sysdeps/unix/sysv/linux/riscv/flush-icache.c +++ b/sysdeps/unix/sysv/linux/riscv/flush-icache.c @@ -38,7 +38,7 @@ __riscv_flush_icache_syscall (void *start, void *end, unsigned long int flags) static func_type __lookup_riscv_flush_icache (void) { - func_type func = get_vdso_symbol ("__vdso_flush_icache"); + func_type func = dl_vdso_vsym ("__vdso_flush_icache"); /* If there is no vDSO entry then call the system call directly. All Linux versions provide the vDSO entry, but QEMU's user-mode emulation doesn't diff --git a/sysdeps/unix/sysv/linux/s390/Makefile b/sysdeps/unix/sysv/linux/s390/Makefile index 77f38523b5..d9db1b5422 100644 --- a/sysdeps/unix/sysv/linux/s390/Makefile +++ b/sysdeps/unix/sysv/linux/s390/Makefile @@ -11,10 +11,6 @@ ifeq ($(subdir),stdlib) gen-as-const-headers += ucontext_i.sym endif -ifeq ($(subdir),elf) -sysdep_routines += dl-vdso -endif - ifeq ($(subdir),nptl) libpthread-sysdep_routines += elision-lock elision-unlock elision-timed \ elision-trylock diff --git a/sysdeps/unix/sysv/linux/sparc/Makefile b/sysdeps/unix/sysv/linux/sparc/Makefile index fb3ee5b8a1..b0d182a439 100644 --- a/sysdeps/unix/sysv/linux/sparc/Makefile +++ b/sysdeps/unix/sysv/linux/sparc/Makefile @@ -7,10 +7,6 @@ librt-routines += rt-sysdep librt-shared-only-routines += rt-sysdep endif -ifeq ($(subdir),elf) -sysdep_routines += dl-vdso -endif - ifeq ($(subdir),sysvipc) sysdep_routines += getshmlba endif diff --git a/sysdeps/unix/sysv/linux/sysdep-vdso.h b/sysdeps/unix/sysv/linux/sysdep-vdso.h index 04525340a5..76c46bea8a 100644 --- a/sysdeps/unix/sysv/linux/sysdep-vdso.h +++ b/sysdeps/unix/sysv/linux/sysdep-vdso.h @@ -19,22 +19,19 @@ #ifndef SYSDEP_VDSO_LINUX_H # define SYSDEP_VDSO_LINUX_H -#include +#include /* Return the errno value as a negative value in case of an error or 0 or positive value otherwise. */ #ifndef INTERNAL_VSYSCALL_CALL -# define INTERNAL_VSYSCALL_CALL(funcptr, nr, args...) \ - funcptr (args) +# define INTERNAL_VSYSCALL_CALL(funcptr, nr, args...) \ + funcptr (args) #endif -#include - #define INLINE_VSYSCALL(name, nr, args...) \ ({ \ long int sc_ret = -1; \ - __typeof (__vdso_##name) vdsop = __vdso_##name; \ - PTR_DEMANGLE (vdsop); \ + __typeof (GLRO(dl_vdso_##name)) vdsop = GLRO(dl_vdso_##name); \ if (vdsop != NULL) \ { \ sc_ret = INTERNAL_VSYSCALL_CALL (vdsop, nr, ##args); \ diff --git a/sysdeps/unix/sysv/linux/x86/Makefile b/sysdeps/unix/sysv/linux/x86/Makefile index 02ca36c6d2..b23b532590 100644 --- a/sysdeps/unix/sysv/linux/x86/Makefile +++ b/sysdeps/unix/sysv/linux/x86/Makefile @@ -20,10 +20,6 @@ CFLAGS-elision-timed.c += -mrtm CFLAGS-elision-trylock.c += -mrtm endif -ifeq ($(subdir),elf) -sysdep_routines += dl-vdso -endif - ifeq ($(subdir),setjmp) tests += tst-saved_mask-1 endif diff --git a/sysdeps/unix/sysv/linux/x86/gettimeofday.c b/sysdeps/unix/sysv/linux/x86/gettimeofday.c index 909575a7e3..f7579ac924 100644 --- a/sysdeps/unix/sysv/linux/x86/gettimeofday.c +++ b/sysdeps/unix/sysv/linux/x86/gettimeofday.c @@ -32,13 +32,10 @@ __gettimeofday_syscall (struct timeval *restrict tv, void *restrict tz) } #ifdef SHARED -# include -# include - # define INIT_ARCH() /* If the vDSO is not available we fall back to syscall. */ libc_ifunc (__gettimeofday, - (get_vdso_symbol (HAVE_GETTIMEOFDAY_VSYSCALL) + (GLRO(dl_vdso_gettimeofday) ?: __gettimeofday_syscall)); #else diff --git a/sysdeps/unix/sysv/linux/x86/time.c b/sysdeps/unix/sysv/linux/x86/time.c index 0aee73826b..c65f2d5d54 100644 --- a/sysdeps/unix/sysv/linux/x86/time.c +++ b/sysdeps/unix/sysv/linux/x86/time.c @@ -30,13 +30,10 @@ time_vsyscall (time_t *t) } #ifdef SHARED -# include -# include - #undef INIT_ARCH #define INIT_ARCH() /* If the vDSO is not available we fall back on the syscall. */ -libc_ifunc (time, (get_vdso_symbol ("__vdso_time") ?: time_vsyscall)) +libc_ifunc (time, (GLRO(dl_vdso_time) ?: time_vsyscall)) #else time_t time (time_t *t) From patchwork Thu Dec 12 18:16:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 181509 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp1118866och; Thu, 12 Dec 2019 10:17:49 -0800 (PST) X-Google-Smtp-Source: APXvYqz1ng0fg4gE6cq93AvxkoIuyS4vypSF8UI1mjYdpayPwxlB0YK4EQOKYAs+R4hH7ZxOT7BC X-Received: by 2002:a9d:6e12:: with SMTP id e18mr9070679otr.47.1576174669522; Thu, 12 Dec 2019 10:17:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576174669; cv=none; d=google.com; s=arc-20160816; b=FhF/l0ZLhsiuNn1YwRkDXbyAze0JGgM7/OGWxznJTteInZ3qr1kWchhwLgivwNqOtX WiOzgb2fDu7x/KRjgSI8+w35hK9VwQ3tR4lwh2dqAqdoQYnlURs1P89mcLnFgrzxH1Qu z9fncs/KyGmI7vLty4pr0lHuLG839yUsSsQYThV48BZ4OL8JtkmWt5/e9PHML0BU7nxH Q9xETn5Waqw/q7cfC/BXcGQ0VLtvIlc2OtNDjHNQNI0nxwsNffvGO9qwrPXb14jP6CKl d9KcO6e3SBBj6cmhXOWzEB4HecJ8ISbenYS5yVsXbzLy0jCGh7LRX17W9tsFRIfRvDPR uLXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=b8k9nhragiPu+B7ySBhYABYhNVGYTdgJpA40aBVlSY4=; b=bqcJEuJaWp20g7deK/+0izuGFsF91spYtMGZi8K87lMLX+4Acq5kJtiYoZmUT2QYtq GIKKNAmRxD2AY4sqB7E0KMEJqKCMz/ueYG91WWPy2KoSTee4/I3C6KDrsvMuX4dbPSg5 gkFXcuRzJyDAtO/YK0UZKtrOtXoJB54StZARaEE4CFa5I2eAuRHrfqIh+XwUXrfiU7e3 6PtgC2nzrAlGPxRCHbtq2XQCXoDLtkO96GNjt+2V/bF65ltbZzSbsmuc9OQCiwrCqQDM fiwgojqtGOBFBioyDTc3E6T3ogFbgVjesL6AbrCuv5HBvxfn/TPwIVpYqrjAgJo0tTEu uZYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=QKOeJtfF; dkim=pass header.i=@linaro.org header.s=google header.b=GVNqtSXQ; spf=pass (google.com: domain of libc-alpha-return-108021-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-108021-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id q18si3617777otc.189.2019.12.12.10.17.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Dec 2019 10:17:49 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-108021-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=QKOeJtfF; dkim=pass header.i=@linaro.org header.s=google header.b=GVNqtSXQ; spf=pass (google.com: domain of libc-alpha-return-108021-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-108021-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=QbKI0OM8oguysebo5G/4HHu1AVsMOv0 knw59wqk+UfiJ/QwQAFl5BqQAQLvEVm7yeAfYRtmaVYoaQHnZjxbCj2RPDVWANo4 l3J78Joc7+TsPGkaKVkJb6PfqFdqjne7h7wT7LIaWRMo221ugNG0wT5fVNQ9BJ6M bwJpX8vuzWKg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=1D1GweN48e3/wBZWkDjV1yacTEI=; b=QKOeJ tfF8kQsCSrfyzaSwMT5xkIF5lq0fShrlF/51S6M39DOdEsfVwWpm/qTlhZHVN9Z6 crAq4Ou8BuUJe9LTZ5dmmloHAEO/7xM26j9yo3v9q4MSfqTkfePZewZ5vW9nXTVi 2fgbGc5U/XCD8V3O+GW1L1N6TQ525S7vz7xmsI= Received: (qmail 44684 invoked by alias); 12 Dec 2019 18:16:35 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 44515 invoked by uid 89); 12 Dec 2019 18:16:34 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-ua1-f66.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=b8k9nhragiPu+B7ySBhYABYhNVGYTdgJpA40aBVlSY4=; b=GVNqtSXQCPvtoumaTnAWxM5tJ9ebwRRWjyvmz9oU59vS5XoagS+N1Z2rajMwrm13wp CA+DWyVxuToYUugyaiI9IneWZrjoLJIPCEZbGUeDWlzYa78ppbpfSyStVmbwG6Z3JD/i wkWnS9ZpHEdnVhNNn3LGqjthCnelFBFBltISBzx0pG9ezzSJCuR2gsVkbBCIdS6uCpRk gM/r0t0cTPBKhkrrw7QxAjDI65FDdf6wZTOgWjUmnU2y4EN8ftGujCwtc8Tgb0dwilLk xxc9eskzzj6nyhc6TUMidzcMtvEJk3aYSv9Q3HXriwo3720YvTGKZE68nF++ONU6ged5 yrJQ== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 08/12] Add support for clock_gettime64 vDSO Date: Thu, 12 Dec 2019 15:16:10 -0300 Message-Id: <20191212181614.31782-8-adhemerval.zanella@linaro.org> In-Reply-To: <20191212181614.31782-1-adhemerval.zanella@linaro.org> References: <20191212181614.31782-1-adhemerval.zanella@linaro.org> No architecture currently defines the vDSO symbol. --- sysdeps/unix/sysv/linux/clock_gettime.c | 12 ++++++++++-- sysdeps/unix/sysv/linux/dl-vdso-setup.c | 4 ++++ sysdeps/unix/sysv/linux/dl-vdso-setup.h | 3 +++ 3 files changed, 17 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/sysdeps/unix/sysv/linux/clock_gettime.c b/sysdeps/unix/sysv/linux/clock_gettime.c index 4ea56c9a4b..43e378aa83 100644 --- a/sysdeps/unix/sysv/linux/clock_gettime.c +++ b/sysdeps/unix/sysv/linux/clock_gettime.c @@ -34,7 +34,11 @@ __clock_gettime64 (clockid_t clock_id, struct __timespec64 *tp) #ifdef __ASSUME_TIME64_SYSCALLS /* 64 bit ABIs or Newer 32-bit ABIs that only support 64-bit time_t. */ # ifdef __NR_clock_gettime64 - r = INLINE_SYSCALL_CALL (clock_gettime64, clock_id, tp); +# ifdef HAVE_CLOCK_GETTIME64_VSYSCALL + r = INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp); +# endif + if (r == -1) + r = INLINE_SYSCALL_CALL (clock_gettime64, clock_id, tp); # else # ifdef HAVE_CLOCK_GETTIME_VSYSCALL r = INLINE_VSYSCALL (clock_gettime, 2, clock_id, tp); @@ -45,7 +49,11 @@ __clock_gettime64 (clockid_t clock_id, struct __timespec64 *tp) #else /* Old 32-bit ABI with possible 64-bit time_t support. */ # ifdef __NR_clock_gettime64 - r = INLINE_SYSCALL_CALL (clock_gettime64, clock_id, tp); +# ifdef HAVE_CLOCK_GETTIME64_VSYSCALL + r = INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp); +# endif + if (r == -1) + r = INLINE_SYSCALL_CALL (clock_gettime64, clock_id, tp); # endif if (r == -1) { diff --git a/sysdeps/unix/sysv/linux/dl-vdso-setup.c b/sysdeps/unix/sysv/linux/dl-vdso-setup.c index 1069879f1a..d19a4af6c1 100644 --- a/sysdeps/unix/sysv/linux/dl-vdso-setup.c +++ b/sysdeps/unix/sysv/linux/dl-vdso-setup.c @@ -45,6 +45,10 @@ PROCINFO_CLASS int (*_dl_vdso_clock_gettime) (clockid_t, struct timespec *) RELRO; #endif +# ifdef HAVE_CLOCK_GETTIME_VSYSCALL +PROCINFO_CLASS int (*_dl_vdso_clock_gettime64) (clockid_t, + struct __timespec64 *) RELRO; +#endif # ifdef HAVE_GETTIMEOFDAY_VSYSCALL PROCINFO_CLASS int (*_dl_vdso_gettimeofday) (struct timeval *, void *) RELRO; #endif diff --git a/sysdeps/unix/sysv/linux/dl-vdso-setup.h b/sysdeps/unix/sysv/linux/dl-vdso-setup.h index f4e76202fc..8a89e100c8 100644 --- a/sysdeps/unix/sysv/linux/dl-vdso-setup.h +++ b/sysdeps/unix/sysv/linux/dl-vdso-setup.h @@ -26,6 +26,9 @@ setup_vdso_pointers (void) #ifdef HAVE_CLOCK_GETTIME_VSYSCALL GLRO(dl_vdso_clock_gettime) = dl_vdso_vsym (HAVE_CLOCK_GETTIME_VSYSCALL); #endif +#ifdef HAVE_CLOCK_GETTIME64_VSYSCALL + GLRO(dl_vdso_clock_gettime64) = dl_vdso_vsym (HAVE_CLOCK_GETTIME64_VSYSCALL); +#endif #ifdef HAVE_GETTIMEOFDAY_VSYSCALL GLRO(dl_vdso_gettimeofday) = dl_vdso_vsym (HAVE_GETTIMEOFDAY_VSYSCALL); #endif From patchwork Thu Dec 12 18:16:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 181510 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp1119091och; Thu, 12 Dec 2019 10:17:59 -0800 (PST) X-Google-Smtp-Source: APXvYqxSFi+LIXULyUgxj+qYyh6TO3pur2XMgmYV0wR/Z49D0Fxi5f3XcMbXIExdxoyj50oX3uMD X-Received: by 2002:a9d:590b:: with SMTP id t11mr531750oth.161.1576174679854; Thu, 12 Dec 2019 10:17:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576174679; cv=none; d=google.com; s=arc-20160816; b=E1RIwkcgeiq3VwowZkc5eRvNrkHxxpNYPOt8TQJjaoisUOi+F6oXIOlzg0z9FPvKWd 81WXfvCtRkoBHH79SZjc8kTH0DTrl4snrFTr4ttRzrg4CDdLHtQGVka38vF/ZhZaydlR yTlnscZw9tah1cQm50WjBOHPFhaez77TyvByu2ka7NjHjcicFDkVmD5fEVvZYsoDxoBY g3lns+p/MINK2wcAcx0e2CmHnM8R4CxZDVrJuCr4fcEmi1B9rRdk2rRDwZ85nQ2gQEld QAEd09j/iwU/bTLVvBSuUE0pu+t4kKIjlvEANKoLnKDKyldiQYUjFXEkKJvU7NDXu79o p/zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=ksM5WLZsOihCy56Sm0ULLXBsJZzuRJv6DVViIctJXn0=; b=CZ4cuwabIhWVHSU1pP0VFADP2p+CmlNmu7ZfPqrGPzD6ejOB+XjhlJzcgnqx+E8wTa RiV9OlxU/bcqugaQ1EV/Idr7OkTeWT/Y3+9rUw634mJxLhi8BmNQA+gQzQQpZkkbFdxZ xm5qvLIr5p+LiDSFHiATdr0HIT4gWWeDWq/GRXGgASuTLiLnW3pc1PTOeK8kN1b5ckc6 VPShdXVq+DbUb1yprbZyk9v6tL/u18wNJFAb/UVOgnG8hoCsAZQCsqe57W/A7SnttXnf IPzbQAHyvBY6jpUmP1QxoqhSbO3OJkRqEezPXoUWny/R/WuMX5livEym5OfK+CYLUiSY ki5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=XvJxbDi4; dkim=pass header.i=@linaro.org header.s=google header.b="e6/NadrI"; spf=pass (google.com: domain of libc-alpha-return-108022-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-108022-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id w29si4052606oth.313.2019.12.12.10.17.59 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Dec 2019 10:17:59 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-108022-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=XvJxbDi4; dkim=pass header.i=@linaro.org header.s=google header.b="e6/NadrI"; spf=pass (google.com: domain of libc-alpha-return-108022-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-108022-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=EOCSvsKFo491teTGAovWUm9gXmv9F28 vG4Y+PB1csaym8euKJllGMWO3/IXA3vCraN0FntTEjsWVW293OAI0p6yO9hVO7yp OfttSTzs5ydYuxNydnoLY524kDEJ20+46Sp9ty284kEBQG1XtQKtsfXYvMag/00I pEHvZRWqDINg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=mg6EbpTPsFdevsHch6ODYernLYU=; b=XvJxb Di4qcP5HRKdLta6vkyKtgbzChwT3tgRyRvfTHca5C8clRIRRc8eCXhbdKhgG7wv+ qoV3Aqw4hZqigzCaxF1TF2lPBNC4+0E6ElQsNEh7TZIg8uqvkdXnAswaPVu9AhMw AcVXK24qv0X6T+uKKCnfgqHTs+3KTd7R7izICA= Received: (qmail 44801 invoked by alias); 12 Dec 2019 18:16:36 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 44704 invoked by uid 89); 12 Dec 2019 18:16:35 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=5.3.0 X-HELO: mail-vk1-f195.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=ksM5WLZsOihCy56Sm0ULLXBsJZzuRJv6DVViIctJXn0=; b=e6/NadrIOCx1EtKpsIJ0GzaBhVvUqiCJyEn/i7E+s36NJQRF0w+7+yRV+HuyZTRGBz 3OfdKdsLn31q2pmH178KhWsIBCObM6BDiMf5TEddB6bOoWEIQKwMSR6X0o6tmGEMTYZI A/bYjT7SB6HtVQPs4WK2FnDreGBtgsplx8YDmTA2qaXBCn0XkgIpXOkg6Sy6rqqkqsxB OuOZ4iqPFE8UffsFj6qLYTHn51cFiluN9mpGvl3q1vIKQAYkEuMQkNsMa9l78MtJojKs TNyGMbNtQVg7r2g98BjV1fELpVjGLRxVdfzDg3HD0GC2jWRxa3c2w3fmSPkadHlkAN4H Q1jw== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 09/12] Enable vDSO clock_gettime64 for i386 Date: Thu, 12 Dec 2019 15:16:11 -0300 Message-Id: <20191212181614.31782-9-adhemerval.zanella@linaro.org> In-Reply-To: <20191212181614.31782-1-adhemerval.zanella@linaro.org> References: <20191212181614.31782-1-adhemerval.zanella@linaro.org> It was added on Linux 5.3 (commit 22ca962288c0a). Checked on i686-linux-gnu with 5.3.0 kernel. --- sysdeps/unix/sysv/linux/i386/sysdep.h | 1 + 1 file changed, 1 insertion(+) -- 2.17.1 diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h index b2e750d490..5156587d95 100644 --- a/sysdeps/unix/sysv/linux/i386/sysdep.h +++ b/sysdeps/unix/sysv/linux/i386/sysdep.h @@ -314,6 +314,7 @@ struct libc_do_syscall_args /* List of system calls which are supported as vsyscalls. */ # define HAVE_CLOCK_GETTIME_VSYSCALL "__vdso_clock_gettime" +# define HAVE_CLOCK_GETTIME64_VSYSCALL "__vdso_clock_gettime64" # define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday" # define HAVE_TIME_VSYSCALL "__vdso_time" # define HAVE_CLOCK_GETRES_VSYSCALL "__vdso_clock_getres" From patchwork Thu Dec 12 18:16:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 181511 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp1119300och; Thu, 12 Dec 2019 10:18:10 -0800 (PST) X-Google-Smtp-Source: APXvYqw3yYDb9PVR8pn8H+oxpfSqqu4yIZfnG30ewhEbkSPdvDAwVOSg6PL4/5YvLqX2dP1r0Eic X-Received: by 2002:aca:5143:: with SMTP id f64mr5702584oib.66.1576174690601; Thu, 12 Dec 2019 10:18:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576174690; cv=none; d=google.com; s=arc-20160816; b=0PS29nGigPX+3ZpI9g4gEg6ykrP0d8wcv0RRgwA/vVLlkOkClfzgXDF6KMCSGq1zaQ 21LS7/oB5YmtnH5u4cJH7aMiY0LVttz6IM9XDfAQev7jpIBIgjgSWLriTGsX25uDt+81 UdxBfUFbM5fUxpP+nwp5DVnfm0CLizkWYeSZ1U6In2fSPXqak2kiRZOOqHVxAorAAmAT E9sBrlfawHYnrN6qvjoOpW3WZhIYMenO8rdXGYLT+/ZabBpW+LrtvHm+sVXm9nv6eAd4 h/2hBJDk2MrBuvYj/eTMhx82mLLF9mqwbPvFs4dAPE0ymbOuieBrZHtBfq0YrBOdSYEg o5lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=UY8E4eukh2+eZZP7cyEy0SiUoXhSL3XyuEeqTt5oGaA=; b=bIViGU6DYd/zR7KJ4bJHpHHOgHdsLD1GP6unzYmMvqodYZFyn3Y4RsKuq8fga9VrIT PgTyZEBY/2lOKV3+533S47sD/EHv4CJPjaYEuUKxObFWRghZbpCwe5dHGSXBdAMfHgJ7 rJjQXvSKUNsx7cjYgxt3zF7TYWNVJbNItiUsL+2v8RYjb45NibchFKg7ZGlcB4uOeSmO wjvCq+WyW8AetmcZ5dGHXgylA9O9MXsYXEq0GLvjAiQjYjr36IzQ19IO3+ouCasu+sGu teTxj3LG9lC4WjHbxmNhN/vBGtoef/Daligm56VKt9BblegkJT0QhmZ2TPGjOpc5jJJh r3Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=Evhvd9Pd; dkim=pass header.i=@linaro.org header.s=google header.b=Cjk1EPvG; spf=pass (google.com: domain of libc-alpha-return-108023-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-108023-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id g200si3706936oib.273.2019.12.12.10.18.10 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Dec 2019 10:18:10 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-108023-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=Evhvd9Pd; dkim=pass header.i=@linaro.org header.s=google header.b=Cjk1EPvG; spf=pass (google.com: domain of libc-alpha-return-108023-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-108023-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=tQt05MvN4LMDGoE6btSth2f04t5/kXs 8Vnpr8tfycNq8JnK0OTKMLZGwwpqmpJiri+UD1tGh07NZ2/5+BEL4Fw/b3aFTkDw R8eX2UD/N056/TU797W7iZZxO3N5hsq808IejPcBk9e74axYtg6BHaQ4xI+VzlbI v4lfoivpGTa4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=DLuZp7xDhbvvZcM275l0LaB7Uxg=; b=Evhvd 9Pd0ZU0VLm6xCcsrN1mUxs1OlxIu94H+cemA3EtoSw272NOf8TTQEzpbRl+CjyOT Shu09B/2VLSnYM6fRcGLueoCcfZ2IP0BUFClng80eFkUjUCq4x4hhN/F9eWBqtTU dLjHd2ei3MQX+qVBv3fV5mxs9il8Cc7riE44Xc= Received: (qmail 45224 invoked by alias); 12 Dec 2019 18:16:38 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 44934 invoked by uid 89); 12 Dec 2019 18:16:36 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-vk1-f196.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=UY8E4eukh2+eZZP7cyEy0SiUoXhSL3XyuEeqTt5oGaA=; b=Cjk1EPvGcWzOQWl3THfcJX3F9fzOfdlMc+3njL6WE6VYHAJ7rv6GfQDuRQ6nqLc8Dw cJ/6kwJoSk+PUK4A92scCrjOdTT/vFD8QRBPleXZxlPNSoKQFY211B5CCk5ohW7G6aMY jz5r31RJPC8fn2D2bmX9CHIT7RaEMwlYgt5FoboFdIQ1O2Jv9zR4wIJcYrZvQsAzzrDE WbeAe4X73cPVAL9omxBSNS8cKThDy44ko0hk9nwnEyUkqSOW4SfkYqiUkLmB3u51wSJm YWQ3AYO9SiJpGcUAiUysQbzitBO49DZXo4XakMdpKN6jTIpviCYrKeB/AB8yULU86djS u7FQ== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 10/12] Enable vDSO clock_gettime64 for arm Date: Thu, 12 Dec 2019 15:16:12 -0300 Message-Id: <20191212181614.31782-10-adhemerval.zanella@linaro.org> In-Reply-To: <20191212181614.31782-1-adhemerval.zanella@linaro.org> References: <20191212181614.31782-1-adhemerval.zanella@linaro.org> It was added on Linux 5.5 (commit 74d06efb9c2f9). --- sysdeps/unix/sysv/linux/arm/sysdep.h | 1 + 1 file changed, 1 insertion(+) -- 2.17.1 diff --git a/sysdeps/unix/sysv/linux/arm/sysdep.h b/sysdeps/unix/sysv/linux/arm/sysdep.h index e9e022e037..b5ef17d1a8 100644 --- a/sysdeps/unix/sysv/linux/arm/sysdep.h +++ b/sysdeps/unix/sysv/linux/arm/sysdep.h @@ -393,6 +393,7 @@ __local_syscall_error: \ /* List of system calls which are supported as vsyscalls. */ #define HAVE_CLOCK_GETTIME_VSYSCALL "__vdso_clock_gettime" +#define HAVE_CLOCK_GETTIME64_VSYSCALL "__vdso_clock_gettime64" #define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday" #define LOAD_ARGS_0() From patchwork Thu Dec 12 18:16:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 181512 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp1119483och; Thu, 12 Dec 2019 10:18:20 -0800 (PST) X-Google-Smtp-Source: APXvYqxJa1NzeN3kLzS5Dz3RU54FVPCeBDpFgqh/wqiSRb85ZcctPp7RybCQ+uFBU2SOysAzBzsA X-Received: by 2002:aca:1106:: with SMTP id 6mr6018046oir.75.1576174700672; Thu, 12 Dec 2019 10:18:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576174700; cv=none; d=google.com; s=arc-20160816; b=AevQERx57zJdAzCatPrykTC43lNq4gm3kjzv6RCAboePjogTJPX/iT5iKjPkRQ/s7V neFzW3yuTMHOrbPIByB8hxcyKVe1xCy3vwbfZRKSD1YPeYuc/f5FeybjbBC5f2vhgM18 lXF7ZN0/gcuR6voSIhbnlI99SonNXAic1BPSEm7kmcX6tfogLaSr/M14tDTCgyzsI6+w Z91zXaJzRLUMiy+6kECEluyeGLBcPqYzYlaUWvfxueObagU0BdHjAk9VFVEf4KZLDzMt CemEnFDjP9d/xeSYrV1aVc3smtJTsNbCCEyRlkCgP5xygbouxNhBx109esb/1vQXZcL7 B3yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=gHsAWySWk9QZaUrvpDDXt5PPnjcjkhbvV/r+xdkoKIY=; b=t5CeRZEzcoSzEkaf8pn1twT7/t/qsDIO5MvC/P6YvUOFsCXgELC1iyhOMCYaBqZTKU 6YgPGFPztP5tY57z90HzdGQv0zBAAbgHYoQVpHZGrUWxpbJ6lD2sitBLdWZ4HonakHKa 0gstEw1DZLbKsFJCfcPkKKkDGrVI4WadInMfDxZoX/K9vIfhy8PahcnURXwamcAe2ucA JQz3rte2QeuRuEuYPG6rFw9Oi3pzzAY5Gpw50S/Ws1yIyEHBoIICpMXGSVSjdVSYF4Nt iE5BNjnupzUshkB8DtGeu2nuOpJkD0/ErDE1YWlIyK4iyvChC/Gusn8A63cPvlq2tScm ZwvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=NBtPDAXh; dkim=pass header.i=@linaro.org header.s=google header.b=mFO4Ru67; spf=pass (google.com: domain of libc-alpha-return-108024-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-108024-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id v20si3529551oia.159.2019.12.12.10.18.20 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Dec 2019 10:18:20 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-108024-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=NBtPDAXh; dkim=pass header.i=@linaro.org header.s=google header.b=mFO4Ru67; spf=pass (google.com: domain of libc-alpha-return-108024-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-108024-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=MtxpzaR9dIvpkLXNuLUlu8T//IOuTcT eiFCE9zS9tLdVSlRq7zWToid0heR5tzepS5xyl02hbIvqWN7LfQYPTMbKLusgf9x 7G0pkxgbQ/Cg2sFDcyRNgPwsefw0X26OeiufTHOCaLEc74/HSSNNbsX8A+uazqrJ sla+YDiYplL0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=ntnlSLNbqcxIBOAiJ02ObGDBIZ0=; b=NBtPD AXhfxPevkenWMUBnnXKjPVapGg+XvcOwTnfY8AwY/2fwE0xcnzYirVRDvcfhCsT9 viFr3SAGbrOAZsgkeS8aP7EgJ4+ZVPS2ecOcRkrVit3oreJwjwq9WmytB02in/Ca TnFMdW/fc3kHIBFPcVSlCXtsCoaxTq1AgXs74I= Received: (qmail 45343 invoked by alias); 12 Dec 2019 18:16:39 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 45202 invoked by uid 89); 12 Dec 2019 18:16:38 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-vs1-f65.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=gHsAWySWk9QZaUrvpDDXt5PPnjcjkhbvV/r+xdkoKIY=; b=mFO4Ru67p8kaex8Q0a/uuIbeNDQDbqZ+3cbniLa+O8NDpJWjeVbzyN1Tpyeg6iQTSh Xvz8y7orelQOgRuqEzNPCVYDNpWWML9ReuYfPo2o/EwdUMyMCWrEgJajAhvoL0lLxuw8 DDXe6hbGt7PwsbGvatHpE7MsmKGCECBCcJTsP5TaloxFNfcHulsOJXIPdbEm3jjUD4gr wrnrbmtW9LKDGktGc+yia/qQz8bvZnY/JP8V92tBr9TulFh3g9pk5ldd4V4ioDFnVn3F v6AciC3/x1wjVKbyedHjT/bimAMznzURV/ww9o5Kf8IwmmjWvsPlt5/bArjomq4J8w7U ZHqQ== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 11/12] Enable vDSO clock_gettime64 for mips Date: Thu, 12 Dec 2019 15:16:13 -0300 Message-Id: <20191212181614.31782-11-adhemerval.zanella@linaro.org> In-Reply-To: <20191212181614.31782-1-adhemerval.zanella@linaro.org> References: <20191212181614.31782-1-adhemerval.zanella@linaro.org> It was added on Linux 5.4 (commit 1f66c45db3302). --- sysdeps/unix/sysv/linux/mips/sysdep.h | 5 +++++ 1 file changed, 5 insertions(+) -- 2.17.1 diff --git a/sysdeps/unix/sysv/linux/mips/sysdep.h b/sysdeps/unix/sysv/linux/mips/sysdep.h index defad8eb62..1705a64157 100644 --- a/sysdeps/unix/sysv/linux/mips/sysdep.h +++ b/sysdeps/unix/sysv/linux/mips/sysdep.h @@ -16,10 +16,15 @@ License along with the GNU C Library. If not, see . */ +#include + #define VDSO_NAME "LINUX_2.6" #define VDSO_HASH 61765110 /* List of system calls which are supported as vsyscalls. */ #define HAVE_CLOCK_GETTIME_VSYSCALL "__vdso_clock_gettime" +#if _MIPS_SIM != _ABI64 +#define HAVE_CLOCK_GETTIME64_VSYSCALL "__vdso_clock_gettime64" +#endif #define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday" #define HAVE_CLOCK_GETRES_VSYSCALL "__vdso_clock_getres" From patchwork Thu Dec 12 18:16:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 181513 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp1119671och; Thu, 12 Dec 2019 10:18:31 -0800 (PST) X-Google-Smtp-Source: APXvYqx6qxAxUbBF0h8BdR9dphT6cKzf5H2uXa7kfZZhf0yHxVQgG1+000PbhrYn1VajdvQUExko X-Received: by 2002:aca:dc45:: with SMTP id t66mr6074939oig.39.1576174711781; Thu, 12 Dec 2019 10:18:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576174711; cv=none; d=google.com; s=arc-20160816; b=Dd8c27G9TsOYGTC+p2kj+hQaAaXgAzaoN2BUEfradMkYVSrYxWDLUCGtogjugl+dj7 FzNNdLf/DUScNTiQlc9JnBzay5hT/s9n4iPruEXux1wSrqzc2rDdzWN0/N2QrApOOmC1 DRaFCsex9KDDvVZWvsuQQ7EirilewdXnjg3Es/wwHbmhO2kE7yVhcQDfl4GYVIibEygF 2Y+aGo5piCNuoCJT29fuBGtGO+7RlOmh0ppM5ylYl3UUkE4KjLjyLKljFq+9tSK3Gv5j fFw0Ze9Q7ZFrj1gW5AaM8x94z3x2R04pwgkiKkMo034iJuScloXdfOBzA88w1e30IqJC CrJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=o/cNTFlOubG8SP4Axe0HLItE6Y6ZGihHGqIB0xMhNTg=; b=C3Kahotd7arjIHCZTY/vbpcrYaLmGR7ivY8klabR3Z0kJ6Kq7x6TC3lKvmKgZhl7UZ 46leuwhb6g2Ilq+K2UQpHTDkLsm1uBnRJ8ozhY161nDiYAqaODStH+aVAZcV0szYsaC9 4pwkqeF9F3o7C5nKTsDeoTgJnPlcernBZxXT8ObtM5EpbkaRiIOxHbUGinY/mb0dVA72 ibOBEXTw+vdx4EU2bSfW2F2748v+IPR+2OSI4oz+gb9Uj6K1sIXgW2ZbdnLym7UeDVkc o0Zhd0qgun3B5oSf2XBhbLVeRgLcu/KWwBjHMrHKGxFhV/t3GF1cahcgv46JLkDv1ly2 kSpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=RrnyFFMZ; dkim=pass header.i=@linaro.org header.s=google header.b=yEc9i+rz; spf=pass (google.com: domain of libc-alpha-return-108025-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-108025-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id y24si3602221oih.24.2019.12.12.10.18.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Dec 2019 10:18:31 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-108025-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=RrnyFFMZ; dkim=pass header.i=@linaro.org header.s=google header.b=yEc9i+rz; spf=pass (google.com: domain of libc-alpha-return-108025-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-108025-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=KkucMy5PfS6+qJed0JKPMBZPPGUX9LR a5cynNlHpelEe5x91/CjQB8cBsMUCmXHSSER7ySEpcsWXchZHKxsahGh4D1gEwKc MBG1REcXW2K/wX25Nbo/AvScWlzTNFBII2ZvKTr4A/sTBfCjDS6r3MRaRrrWnCXp ll14FedqHf4c= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=DDCaXE53O88OYFN4IpT38BFBYio=; b=RrnyF FMZowmdBTf5Ou3Gd4TYZc6ubXm7JBhJQ8m99N35A40zDlC1+zIbEDU9FKt5HJBiG zOjU+sU/UVaG5Tzi/ScRKHWHmSCqxO212fNs2dge+9fO6Uwg4ujUfWUuQDS7mF2h MVhPRG8nF03BqWO/KArCSHvU4swu3VgN0zxXEI= Received: (qmail 47829 invoked by alias); 12 Dec 2019 18:16:57 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 45453 invoked by uid 89); 12 Dec 2019 18:16:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-vs1-f65.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=o/cNTFlOubG8SP4Axe0HLItE6Y6ZGihHGqIB0xMhNTg=; b=yEc9i+rzC4lXMwzQ5ZFm8UL+GiddkT3f1iH0KUkLyrKHTlOSeCThWr+lsAh+x7uy4d CIDTYgJvKWLAhCwIHIzH7zPYAP9exmDivULLsaPQZN6wFgnsdwGK4EY3yAxukU5Dhdp7 dcKVfOwl5FMo5GIMpVRI+TDuBH3YU0FErejo5a7I6g359ZiJ7oC4QmMvTGCjKzWV3k9G gBjpWJAYxZtzRdWVW+wQaMwQdqYZFjpHsDVpPMfaeqHp/I37SwHg+vhaUEgTsmQ1Kmc+ UkA7h+1GDzqfqvLDI3ldAJXsHleG55ZKsdCHcLcL6MC+OpPzp3BYGSWL+A4+F4d0xfou 37QA== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 12/12] Add support for clock_getres64 vDSO Date: Thu, 12 Dec 2019 15:16:14 -0300 Message-Id: <20191212181614.31782-12-adhemerval.zanella@linaro.org> In-Reply-To: <20191212181614.31782-1-adhemerval.zanella@linaro.org> References: <20191212181614.31782-1-adhemerval.zanella@linaro.org> No architecture currently defines the vDSO symbol. --- sysdeps/unix/sysv/linux/clock_getres.c | 12 ++++++++++-- sysdeps/unix/sysv/linux/dl-vdso-setup.c | 4 ++++ sysdeps/unix/sysv/linux/dl-vdso-setup.h | 3 +++ 3 files changed, 17 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/sysdeps/unix/sysv/linux/clock_getres.c b/sysdeps/unix/sysv/linux/clock_getres.c index 6c12f1d1e9..39481afe22 100644 --- a/sysdeps/unix/sysv/linux/clock_getres.c +++ b/sysdeps/unix/sysv/linux/clock_getres.c @@ -33,7 +33,11 @@ __clock_getres64 (clockid_t clock_id, struct __timespec64 *res) #ifdef __ASSUME_TIME64_SYSCALLS /* 64 bit ABIs or Newer 32-bit ABIs that only support 64-bit time_t. */ # ifdef __NR_clock_getres_time64 - r = INLINE_SYSCALL_CALL (clock_getres_time64, clock_id, res); +# ifdef HAVE_CLOCK_GETRES64_VSYSCALL + r = INLINE_VSYSCALL (clock_getres64, 2, clock_id, tp) +# endif + if (r == -1) + r = INLINE_SYSCALL_CALL (clock_getres_time64, clock_id, res); # else # ifdef HAVE_CLOCK_GETRES_VSYSCALL r = INLINE_VSYSCALL (clock_getres, 2, clock_id, res); @@ -44,7 +48,11 @@ __clock_getres64 (clockid_t clock_id, struct __timespec64 *res) #else /* Old 32-bit ABI with possible 64-bit time_t support. */ # ifdef __NR_clock_getres_time64 - r = INLINE_SYSCALL_CALL (clock_getres_time64, clock_id, res); +# ifdef HAVE_CLOCK_GETRES64_VSYSCALL + r = INLINE_VSYSCALL (clock_getres64, 2, clock_id, tp) +# endif + if (r == -1) + r = INLINE_SYSCALL_CALL (clock_getres_time64, clock_id, res); # endif if (r == -1) { diff --git a/sysdeps/unix/sysv/linux/dl-vdso-setup.c b/sysdeps/unix/sysv/linux/dl-vdso-setup.c index d19a4af6c1..620348e2c7 100644 --- a/sysdeps/unix/sysv/linux/dl-vdso-setup.c +++ b/sysdeps/unix/sysv/linux/dl-vdso-setup.c @@ -62,6 +62,10 @@ PROCINFO_CLASS int (*_dl_vdso_getcpu) (unsigned *, unsigned *, void *) RELRO; PROCINFO_CLASS int (*_dl_vdso_clock_getres) (clockid_t, struct timespec *) RELRO; # endif +# ifdef HAVE_CLOCK_GETRES64_VSYSCALL +PROCINFO_CLASS int (*_dl_vdso_clock_getres64) (clockid_t, + struct __timespec64 *) RELRO; +# endif /* PowerPC specific ones. */ # ifdef HAVE_GET_TBFREQ diff --git a/sysdeps/unix/sysv/linux/dl-vdso-setup.h b/sysdeps/unix/sysv/linux/dl-vdso-setup.h index 8a89e100c8..005acf15f7 100644 --- a/sysdeps/unix/sysv/linux/dl-vdso-setup.h +++ b/sysdeps/unix/sysv/linux/dl-vdso-setup.h @@ -41,6 +41,9 @@ setup_vdso_pointers (void) #ifdef HAVE_CLOCK_GETRES_VSYSCALL GLRO(dl_vdso_clock_getres) = dl_vdso_vsym (HAVE_CLOCK_GETRES_VSYSCALL); #endif +#ifdef HAVE_CLOCK_GETRES64_VSYSCALL + GLRO(dl_vdso_clock_getres64) = dl_vdso_vsym (HAVE_CLOCK_GETRES64_VSYSCALL); +#endif #ifdef HAVE_GET_TBFREQ GLRO(dl_vdso_get_tbfreq) = dl_vdso_vsym (HAVE_GET_TBFREQ); #endif