Re: [PATCH v7 0/7] powerpc: switch VDSO to C implementation

From: Arnd Bergmann
Date: Tue Apr 21 2020 - 03:35:27 EST


On Tue, Apr 21, 2020 at 8:56 AM Christophe Leroy
<christophe.leroy@xxxxxx> wrote:
> Le 20/04/2020 Ã 21:57, Arnd Bergmann a Ãcrit :
>
> Yes that was one of the objective, be able to add that as a second step.
> First objective was adding the missing clocks and increasing
> maintainability.
>
> I can add a patch for that now, it looks easy, but how do I test it ?
> vdsotest from Nathan doesn't seem to test that.

I wasn't aware of vdsotest, but I suppose it should be fixed in there
as well. It's only one extra call that is supposed to be available on
all 32-bit architectures.

The other thing to try is musl libc 1.2, or any distro based on it.
https://distfiles.adelielinux.org/adelie/1.0/iso/rc1/ has a ppc32
image file.

I think this is all you should need to do to enable vdso in musl:

--- a/arch/powerpc/syscall_arch.h
+++ b/arch/powerpc/syscall_arch.h
@@ -92,3 +92,9 @@ static inline long __syscall6(long n, long a, long
b, long c, long d, long e, lo

#define SO_RCVTIMEO_OLD 18
#define SO_SNDTIMEO_OLD 19
+
+#define VDSO_USEFUL
+#define VDSO_CGT32_SYM "__vdso_clock_gettime"
+#define VDSO_CGT32_VER "LINUX_2.6"
+#define VDSO_CGT_SYM "__vdso_clock_gettime64"
+#define VDSO_CGT_VER "LINUX_2.6"

At the moment, the vdso is just disabled for powerpc because there is no
__vdso_clock_gettime64 definition in the kernel.

> > Without it, any 32-bit user space has to go through the system call
> > for time()/getttimeofday()/clock_gettime() when built with a
> > modern libc.
> >
>
> How modern ? I have glibc 2.28, the only symbols it seems to know are
> (extracted with 'strings') :
>
> __vdso_clock_gettime
> __vdso_time
> __vdso_get_tbfreq
> __vdso_getcpu
> __vdso_clock_getres
> __vdso_sigtramp32
> __vdso_sigtramp_rt32
> __vdso_gettimeofday

Mainline glibc still doesn't have it, I don't know when it will,
presumably either
the coming 2.32 release, or 2.33. There is a tree at
https://github.com/lmajewski/y2038_glibc/commits/y2038_edge that has the
necessary changes, and it is slowly getting merged upstream.

Arnd