powerpc/vdso: fix clock_gettime_fallback for vdso32
PATCH 1/1 powerpc/vdso: fix clock_gettime_fallback for vdso32
The second argument of __kernel_clock_gettime64 points to a struct __kernel_timespec, with 64-bit time_t, so use the clock_gettime64 syscall in the fallback function for the 32-bit vdso. Similarily, clock_getres_fallback should use the clock_getres_time64 syscall, though it isn't yet called from the 32-bit vdso.
--- arch/powerpc/include/asm/vdso/gettimeofday.h | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/powerpc/include/asm/vdso/gettimeofday.h +8 -0
@@ -106,13 +106,21 @@ int gettimeofday_fallback(struct __kernel_old_timeval *_tv, struct timezone *_tzstatic __always_inline int clock_gettime_fallback(clockid_t _clkid, struct __kernel_timespec *_ts) { +#ifndef __powerpc64__ +return do_syscall_2 (__NR_clock_gettime64, _clkid, (unsigned long )_ts); +#else return do_syscall_2 (__NR_clock_gettime, _clkid, (unsigned long )_ts); +#endif }static __always_inline int clock_getres_fallback(clockid_t _clkid, struct __kernel_timespec *_ts) { +#ifndef __powerpc64__ +return do_syscall_2 (__NR_clock_getres_time64, _clkid, (unsigned long )_ts); +#else return do_syscall_2 (__NR_clock_getres, _clkid, (unsigned long )_ts); +#endif }#ifdef CONFIG_VDSO32
Signature · 7 lines
2.30.0 -- Andreas Schwab, [email protected] GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."
Le 11/01/2021 à 16:18, Andreas Schwab a écrit :
Quoted 7 lines
The second argument of
__kernel_clock_gettime64points to a struct__kernel_timespec, with 64-bittime_t, so use theclock_gettime64syscall in the fallback function for the 32-bit vdso. Similarily,clock_getres_fallbackshould use theclock_getres_time64syscall, though it isn't yet called from the 32-bit vdso.Signed-off-by Andreas Schwab <[email protected]>
arch/powerpc/include/asm/vdso/gettimeofday.h int gettimeofday_fallback(struct __kernel_old_timeval *_tv, struct timezone *_tz · line 109
Quoted 13 lines
--- arch/powerpc/include/asm/vdso/gettimeofday.h | 8 ++++++++ 1 file changed, 8 insertions(+)arch/powerpc/include/asm/vdso/gettimeofday.h +1
-0@@ -106,13 +106,21 @@ int gettimeofday_fallback(struct __kernel_old_timeval *_tv, struct timezone *_tzstatic __always_inline int clock_gettime_fallback(clockid_t _clkid, struct __kernel_timespec *_ts) { +#ifndef __powerpc64__
I think we should do like x86, create a second version of clock_gettime_fallback() inside the #ifdef CONFIG_VDSO32, and move that one in a matching (non existing yet) #else
arch/powerpc/include/asm/vdso/gettimeofday.h int gettimeofday_fallback(struct __kernel_old_timeval *_tv, struct timezone *_tz · line 119
Quoted 10 lines
arch/powerpc/include/asm/vdso/gettimeofday.h +4
-0+return do_syscall_2 (__NR_clock_gettime64, _clkid, (unsigned long )_ts); +#else return do_syscall_2 (__NR_clock_gettime, _clkid, (unsigned long )_ts); +#endif }static __always_inline int clock_getres_fallback(clockid_t _clkid, struct __kernel_timespec *_ts) { +#ifndef __powerpc64__
Same.
arch/powerpc/include/asm/vdso/gettimeofday.h int gettimeofday_fallback(struct __kernel_old_timeval *_tv, struct timezone *_tz · line 126
Quoted 8 lines
arch/powerpc/include/asm/vdso/gettimeofday.h +3
-0+return do_syscall_2 (__NR_clock_getres_time64, _clkid, (unsigned long )_ts); +#else return do_syscall_2 (__NR_clock_getres, _clkid, (unsigned long )_ts); +#endif }#ifdef CONFIG_VDSO32
Christophe