Skip to content

Commit 41131a5

Browse files
andreas-schwabmpe
authored andcommitted
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. Similarly, clock_getres_fallback should use the clock_getres_time64 syscall, though it isn't yet called from the 32-bit VDSO. Fixes: d0e3fc6 ("powerpc/vdso: Provide __kernel_clock_gettime64() on vdso32") Signed-off-by: Andreas Schwab <[email protected]> [chleroy: Moved into a single #ifdef __powerpc64__ block] Signed-off-by: Christophe Leroy <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/0c0ab0eb3cc80687c326f76ff0dd5762b8812ecc.1610452505.git.christophe.leroy@csgroup.eu
1 parent 2225a8d commit 41131a5

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

arch/powerpc/include/asm/vdso/gettimeofday.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ int gettimeofday_fallback(struct __kernel_old_timeval *_tv, struct timezone *_tz
103103
return do_syscall_2(__NR_gettimeofday, (unsigned long)_tv, (unsigned long)_tz);
104104
}
105105

106+
#ifdef __powerpc64__
107+
106108
static __always_inline
107109
int clock_gettime_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
108110
{
@@ -115,10 +117,22 @@ int clock_getres_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
115117
return do_syscall_2(__NR_clock_getres, _clkid, (unsigned long)_ts);
116118
}
117119

118-
#ifdef CONFIG_VDSO32
120+
#else
119121

120122
#define BUILD_VDSO32 1
121123

124+
static __always_inline
125+
int clock_gettime_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
126+
{
127+
return do_syscall_2(__NR_clock_gettime64, _clkid, (unsigned long)_ts);
128+
}
129+
130+
static __always_inline
131+
int clock_getres_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
132+
{
133+
return do_syscall_2(__NR_clock_getres_time64, _clkid, (unsigned long)_ts);
134+
}
135+
122136
static __always_inline
123137
int clock_gettime32_fallback(clockid_t _clkid, struct old_timespec32 *_ts)
124138
{

0 commit comments

Comments
 (0)