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


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

Re: 32bit builds broken by gettime64 vDSO patches



On 10/12/2019 09:16, Manuel Lauss wrote:
> Hello,
> 
> 32bit builds of latest git head  (tested x86, MIPS o32, ARM, SH4)
> break on my system; 64 bit (arm64, x86_64) builds are fine.
> Reverting Alistair Francis' 2 clock_gettime64 patches fixes that.
> 
[...]
> 
> glibc is configured thusly:
> configure --enable-stack-protector=no
> --enable-stackguard-randomization --disable-cet --enable-kernel=5.2.0
> --without-selinux --without-cvs --disable-werror --enable-bind-now
> --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --disable-profile
> --without-gd --with-headers=/usr/include --prefix=/usr
> --sysconfdir=/etc --localstatedir=/var --libdir=$(prefix)/lib
> --mandir=$(prefix)/share/man --infodir=$(prefix)/share/info
> --libexecdir=$(libdir)/misc/glibc
> --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion=Gentoo
> 2.30-r3 p4 --enable-crypt --disable-systemtap --disable-nscd
> --disable-timezone-tools

Sigh... it looks like I forgot to take in consideration that the
scenario 10. from [1] might also occur with for 32-bit with
--enable-kernel=5.2.0.  In this case INLINE_VSYSCALL will try
to use the vDSO regardless HAVE_CLOCK_GETTIME64_VSYSCALL is set
or not.

It seems we will need to add even more pre-processor handling to
work this:

diff --git a/sysdeps/unix/sysv/linux/clock_gettime.c b/sysdeps/unix/sysv/linux/clock_gettime.c
index 875c4fe905..10bb6c5d16 100644
--- a/sysdeps/unix/sysv/linux/clock_gettime.c
+++ b/sysdeps/unix/sysv/linux/clock_gettime.c
@@ -34,11 +34,17 @@ int
 __clock_gettime64 (clockid_t clock_id, struct __timespec64 *tp)
 {
 #ifdef __ASSUME_TIME64_SYSCALLS
-# ifndef __NR_clock_gettime64
-#  define __NR_clock_gettime64   __NR_clock_gettime
-#  define __vdso_clock_gettime64 __vdso_clock_gettime
+# if defined HAVE_CLOCK_GETTIME64_VSYSCALL
+  return INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp);
+# elif defined HAVE_CLOCK_GETTIME_VSYSCALL && !defined __NR_clock_gettime64
+  return INLINE_VSYSCALL (clock_gettime, 2, clock_id, tp);
+# else
+#  ifndef __NR_clock_gettime64
+#   define __NR_clock_gettime64   __NR_clock_gettime
+#   define __vdso_clock_gettime64 __vdso_clock_gettime
+#  endif
+  return 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);

This code is becoming highly convoluted and hard to understand,
I will check it this is the correct fix for all options and work
towards on my vDSO refactor to simplify this.

[1] https://sourceware.org/ml/libc-alpha/2019-12/msg00142.html


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