public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
* 32bit builds broken by gettime64 vDSO patches
@ 2019-12-10 12:17 Manuel Lauss
  2019-12-10 21:56 ` Adhemerval Zanella
  2019-12-13 14:05 ` Lukasz Majewski
  0 siblings, 2 replies; 4+ messages in thread
From: Manuel Lauss @ 2019-12-10 12:17 UTC (permalink / raw)
  To: libc-help

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.

In file included from ../sysdeps/unix/sysv/linux/clock_gettime.c:28:
../sysdeps/unix/sysv/linux/clock_gettime.c: In function ‘__clock_gettime64’:
../sysdeps/unix/sysv/linux/sysdep-vdso.h:40:15: error:
‘__vdso_clock_gettime64’ undeclared (first use in this function); did
you mean ‘__vdso_clock_gettime’?
   40 |     __typeof (__vdso_##name) vdsop = __vdso_##name;         \
      |               ^~~~~~~
../sysdeps/unix/sysv/linux/clock_gettime.c:41:11: note: in expansion
of macro ‘INLINE_VSYSCALL’
   41 |    return INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp);
      |           ^~~~~~~~~~~~~~~
../sysdeps/unix/sysv/linux/sysdep-vdso.h:40:15: note: each undeclared
identifier is reported only once for each function it appears in
   40 |     __typeof (__vdso_##name) vdsop = __vdso_##name;         \
      |               ^~~~~~~
../sysdeps/unix/sysv/linux/clock_gettime.c:41:11: note: in expansion
of macro ‘INLINE_VSYSCALL’
   41 |    return INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp);
      |           ^~~~~~~~~~~~~~~
../sysdeps/unix/sysv/linux/sysdep-vdso.h:42:15: warning: comparison
between pointer and integer
   42 |     if (vdsop != NULL)             \
      |               ^~
../sysdeps/unix/sysv/linux/clock_gettime.c:41:11: note: in expansion
of macro ‘INLINE_VSYSCALL’
   41 |    return INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp);
      |           ^~~~~~~~~~~~~~~
In file included from ../sysdeps/unix/sysv/linux/clock_gettime.c:28:
../sysdeps/unix/sysv/linux/sysdep-vdso.h:44:35: error: called object
‘vdsop’ is not a function or function pointer
   44 |  sc_ret = INTERNAL_VSYSCALL_CALL (vdsop, sc_err, nr, ##args);       \
      |                                   ^~~~~
../sysdeps/unix/sysv/linux/sysdep-vdso.h:26:6: note: in definition of
macro ‘INTERNAL_VSYSCALL_CALL’
   26 |      funcptr (args)
      |      ^~~~~~~
../sysdeps/unix/sysv/linux/clock_gettime.c:41:11: note: in expansion
of macro ‘INLINE_VSYSCALL’
   41 |    return INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp);
      |           ^~~~~~~~~~~~~~~
In file included from ../sysdeps/unix/sysv/linux/clock_gettime.c:28:
../sysdeps/unix/sysv/linux/sysdep-vdso.h:40:30: note: declared here
   40 |     __typeof (__vdso_##name) vdsop = __vdso_##name;         \
      |                              ^~~~~
../sysdeps/unix/sysv/linux/clock_gettime.c:41:11: note: in expansion
of macro ‘INLINE_VSYSCALL’
   41 |    return INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp);
      |           ^~~~~~~~~~~~~~~
make[2]: *** [/tmp-ram/portage/sys-libs/glibc-2.30-r3/work/build-x86-x86_64-pc-linux-gnu-nptl/sysd-rules:213:
/tmp-ram/portage/sys-libs/glibc-2.30-r3/work/build-x86-x86_64-pc-linux-gnu-nptl/time/clock_gettime.o]
Error 1
make[2]: Leaving directory
'/tmp-ram/portage/sys-libs/glibc-2.30-r3/work/glibc-2.30/time'

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


Thanks!
     Manuel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 32bit builds broken by gettime64 vDSO patches
  2019-12-10 12:17 32bit builds broken by gettime64 vDSO patches Manuel Lauss
@ 2019-12-10 21:56 ` Adhemerval Zanella
  2019-12-13 14:05 ` Lukasz Majewski
  1 sibling, 0 replies; 4+ messages in thread
From: Adhemerval Zanella @ 2019-12-10 21:56 UTC (permalink / raw)
  To: libc-help



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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 32bit builds broken by gettime64 vDSO patches
  2019-12-10 12:17 32bit builds broken by gettime64 vDSO patches Manuel Lauss
  2019-12-10 21:56 ` Adhemerval Zanella
@ 2019-12-13 14:05 ` Lukasz Majewski
  2019-12-13 16:58   ` Manuel Lauss
  1 sibling, 1 reply; 4+ messages in thread
From: Lukasz Majewski @ 2019-12-13 14:05 UTC (permalink / raw)
  To: Manuel Lauss; +Cc: libc-help, Adhemerval Zanella, Alistair Francis

[-- Attachment #1: Type: text/plain, Size: 4423 bytes --]

Hi Manuel,

> 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.
> 
> In file included from ../sysdeps/unix/sysv/linux/clock_gettime.c:28:
> ../sysdeps/unix/sysv/linux/clock_gettime.c: In function
> ‘__clock_gettime64’: ../sysdeps/unix/sysv/linux/sysdep-vdso.h:40:15:
> error: ‘__vdso_clock_gettime64’ undeclared (first use in this
> function); did you mean ‘__vdso_clock_gettime’?
>    40 |     __typeof (__vdso_##name) vdsop = __vdso_##name;         \
>       |               ^~~~~~~
> ../sysdeps/unix/sysv/linux/clock_gettime.c:41:11: note: in expansion
> of macro ‘INLINE_VSYSCALL’
>    41 |    return INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp);
>       |           ^~~~~~~~~~~~~~~
> ../sysdeps/unix/sysv/linux/sysdep-vdso.h:40:15: note: each undeclared
> identifier is reported only once for each function it appears in
>    40 |     __typeof (__vdso_##name) vdsop = __vdso_##name;         \
>       |               ^~~~~~~
> ../sysdeps/unix/sysv/linux/clock_gettime.c:41:11: note: in expansion
> of macro ‘INLINE_VSYSCALL’
>    41 |    return INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp);
>       |           ^~~~~~~~~~~~~~~
> ../sysdeps/unix/sysv/linux/sysdep-vdso.h:42:15: warning: comparison
> between pointer and integer
>    42 |     if (vdsop != NULL)             \
>       |               ^~
> ../sysdeps/unix/sysv/linux/clock_gettime.c:41:11: note: in expansion
> of macro ‘INLINE_VSYSCALL’
>    41 |    return INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp);
>       |           ^~~~~~~~~~~~~~~
> In file included from ../sysdeps/unix/sysv/linux/clock_gettime.c:28:
> ../sysdeps/unix/sysv/linux/sysdep-vdso.h:44:35: error: called object
> ‘vdsop’ is not a function or function pointer
>    44 |  sc_ret = INTERNAL_VSYSCALL_CALL (vdsop, sc_err, nr, ##args);
>       \ |                                   ^~~~~
> ../sysdeps/unix/sysv/linux/sysdep-vdso.h:26:6: note: in definition of
> macro ‘INTERNAL_VSYSCALL_CALL’
>    26 |      funcptr (args)
>       |      ^~~~~~~
> ../sysdeps/unix/sysv/linux/clock_gettime.c:41:11: note: in expansion
> of macro ‘INLINE_VSYSCALL’
>    41 |    return INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp);
>       |           ^~~~~~~~~~~~~~~
> In file included from ../sysdeps/unix/sysv/linux/clock_gettime.c:28:
> ../sysdeps/unix/sysv/linux/sysdep-vdso.h:40:30: note: declared here
>    40 |     __typeof (__vdso_##name) vdsop = __vdso_##name;         \
>       |                              ^~~~~
> ../sysdeps/unix/sysv/linux/clock_gettime.c:41:11: note: in expansion
> of macro ‘INLINE_VSYSCALL’
>    41 |    return INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp);
>       |           ^~~~~~~~~~~~~~~
> make[2]: ***
> [/tmp-ram/portage/sys-libs/glibc-2.30-r3/work/build-x86-x86_64-pc-linux-gnu-nptl/sysd-rules:213:
> /tmp-ram/portage/sys-libs/glibc-2.30-r3/work/build-x86-x86_64-pc-linux-gnu-nptl/time/clock_gettime.o]
> Error 1 make[2]: Leaving directory
> '/tmp-ram/portage/sys-libs/glibc-2.30-r3/work/glibc-2.30/time'
> 
> 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
> 

Do you use kernel headers > 5.1 but < 5.4 (32 bit) ? 

For 32 bit devices there is a fix available:
https://github.com/lmajewski/y2038_glibc/commit/93a26fc4b3c4c3f57dec539d1f3244f7ae417be3


> 
> Thanks!
>      Manuel




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 484 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 32bit builds broken by gettime64 vDSO patches
  2019-12-13 14:05 ` Lukasz Majewski
@ 2019-12-13 16:58   ` Manuel Lauss
  0 siblings, 0 replies; 4+ messages in thread
From: Manuel Lauss @ 2019-12-13 16:58 UTC (permalink / raw)
  To: Lukasz Majewski; +Cc: libc-help, Adhemerval Zanella, Alistair Francis

Hi Lukasz,

I tried --enable-kernel=3.2.0 (Gentoo default), 5.3.0 and 5.4.0,  none
work.    Your patch however does fix the build!

Manuel

On Fri, Dec 13, 2019 at 3:05 PM Lukasz Majewski <lukma@denx.de> wrote:
>
> Hi Manuel,
>
> > 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.
> >
> > In file included from ../sysdeps/unix/sysv/linux/clock_gettime.c:28:
> > ../sysdeps/unix/sysv/linux/clock_gettime.c: In function
> > ‘__clock_gettime64’: ../sysdeps/unix/sysv/linux/sysdep-vdso.h:40:15:
> > error: ‘__vdso_clock_gettime64’ undeclared (first use in this
> > function); did you mean ‘__vdso_clock_gettime’?
> >    40 |     __typeof (__vdso_##name) vdsop = __vdso_##name;         \
> >       |               ^~~~~~~
> > ../sysdeps/unix/sysv/linux/clock_gettime.c:41:11: note: in expansion
> > of macro ‘INLINE_VSYSCALL’
> >    41 |    return INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp);
> >       |           ^~~~~~~~~~~~~~~
> > ../sysdeps/unix/sysv/linux/sysdep-vdso.h:40:15: note: each undeclared
> > identifier is reported only once for each function it appears in
> >    40 |     __typeof (__vdso_##name) vdsop = __vdso_##name;         \
> >       |               ^~~~~~~
> > ../sysdeps/unix/sysv/linux/clock_gettime.c:41:11: note: in expansion
> > of macro ‘INLINE_VSYSCALL’
> >    41 |    return INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp);
> >       |           ^~~~~~~~~~~~~~~
> > ../sysdeps/unix/sysv/linux/sysdep-vdso.h:42:15: warning: comparison
> > between pointer and integer
> >    42 |     if (vdsop != NULL)             \
> >       |               ^~
> > ../sysdeps/unix/sysv/linux/clock_gettime.c:41:11: note: in expansion
> > of macro ‘INLINE_VSYSCALL’
> >    41 |    return INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp);
> >       |           ^~~~~~~~~~~~~~~
> > In file included from ../sysdeps/unix/sysv/linux/clock_gettime.c:28:
> > ../sysdeps/unix/sysv/linux/sysdep-vdso.h:44:35: error: called object
> > ‘vdsop’ is not a function or function pointer
> >    44 |  sc_ret = INTERNAL_VSYSCALL_CALL (vdsop, sc_err, nr, ##args);
> >       \ |                                   ^~~~~
> > ../sysdeps/unix/sysv/linux/sysdep-vdso.h:26:6: note: in definition of
> > macro ‘INTERNAL_VSYSCALL_CALL’
> >    26 |      funcptr (args)
> >       |      ^~~~~~~
> > ../sysdeps/unix/sysv/linux/clock_gettime.c:41:11: note: in expansion
> > of macro ‘INLINE_VSYSCALL’
> >    41 |    return INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp);
> >       |           ^~~~~~~~~~~~~~~
> > In file included from ../sysdeps/unix/sysv/linux/clock_gettime.c:28:
> > ../sysdeps/unix/sysv/linux/sysdep-vdso.h:40:30: note: declared here
> >    40 |     __typeof (__vdso_##name) vdsop = __vdso_##name;         \
> >       |                              ^~~~~
> > ../sysdeps/unix/sysv/linux/clock_gettime.c:41:11: note: in expansion
> > of macro ‘INLINE_VSYSCALL’
> >    41 |    return INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp);
> >       |           ^~~~~~~~~~~~~~~
> > make[2]: ***
> > [/tmp-ram/portage/sys-libs/glibc-2.30-r3/work/build-x86-x86_64-pc-linux-gnu-nptl/sysd-rules:213:
> > /tmp-ram/portage/sys-libs/glibc-2.30-r3/work/build-x86-x86_64-pc-linux-gnu-nptl/time/clock_gettime.o]
> > Error 1 make[2]: Leaving directory
> > '/tmp-ram/portage/sys-libs/glibc-2.30-r3/work/glibc-2.30/time'
> >
> > 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
> >
>
> Do you use kernel headers > 5.1 but < 5.4 (32 bit) ?
>
> For 32 bit devices there is a fix available:
> https://github.com/lmajewski/y2038_glibc/commit/93a26fc4b3c4c3f57dec539d1f3244f7ae417be3
>
>
> >
> > Thanks!
> >      Manuel
>
>
>
>
> Best regards,
>
> Lukasz Majewski
>
> --
>
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-12-13 16:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-10 12:17 32bit builds broken by gettime64 vDSO patches Manuel Lauss
2019-12-10 21:56 ` Adhemerval Zanella
2019-12-13 14:05 ` Lukasz Majewski
2019-12-13 16:58   ` Manuel Lauss

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).