Skip to content

Commit 5233841

Browse files
chenhuacaiKAGA-KOKO
authored andcommitted
timekeeping/vsyscall: Update VDSO data unconditionally
The update of the VDSO data is depending on __arch_use_vsyscall() returning True. This is a leftover from the attempt to map the features of various architectures 1:1 into generic code. The usage of __arch_use_vsyscall() in the actual vsyscall implementations got dropped and replaced by the requirement for the architecture code to return U64_MAX if the global clocksource is not usable in the VDSO. But the __arch_use_vsyscall() check in the update code stayed which causes the VDSO data to be stale or invalid when an architecture actually implements that function and returns False when the current clocksource is not usable in the VDSO. As a consequence the VDSO implementations of clock_getres(), time(), clock_gettime(CLOCK_.*_COARSE) operate on invalid data and return bogus information. Remove the __arch_use_vsyscall() check from the VDSO update function and update the VDSO data unconditionally. [ tglx: Massaged changelog and removed the now useless implementations in asm-generic/ARM64/MIPS ] Fixes: 44f57d7 ("timekeeping: Provide a generic update_vsyscall() implementation") Signed-off-by: Huacai Chen <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Vincenzo Frascino <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Paul Burton <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected]
1 parent d7e8d14 commit 5233841

File tree

4 files changed

+3
-27
lines changed

4 files changed

+3
-27
lines changed

arch/arm64/include/asm/vdso/vsyscall.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,6 @@ int __arm64_get_clock_mode(struct timekeeper *tk)
3030
}
3131
#define __arch_get_clock_mode __arm64_get_clock_mode
3232

33-
static __always_inline
34-
int __arm64_use_vsyscall(struct vdso_data *vdata)
35-
{
36-
return !vdata[CS_HRES_COARSE].clock_mode;
37-
}
38-
#define __arch_use_vsyscall __arm64_use_vsyscall
39-
4033
static __always_inline
4134
void __arm64_update_vsyscall(struct vdso_data *vdata, struct timekeeper *tk)
4235
{

arch/mips/include/asm/vdso/vsyscall.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,6 @@ int __mips_get_clock_mode(struct timekeeper *tk)
2828
}
2929
#define __arch_get_clock_mode __mips_get_clock_mode
3030

31-
static __always_inline
32-
int __mips_use_vsyscall(struct vdso_data *vdata)
33-
{
34-
return (vdata[CS_HRES_COARSE].clock_mode != VDSO_CLOCK_NONE);
35-
}
36-
#define __arch_use_vsyscall __mips_use_vsyscall
37-
3831
/* The asm-generic header needs to be included after the definitions above */
3932
#include <asm-generic/vdso/vsyscall.h>
4033

include/asm-generic/vdso/vsyscall.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,6 @@ static __always_inline int __arch_get_clock_mode(struct timekeeper *tk)
2525
}
2626
#endif /* __arch_get_clock_mode */
2727

28-
#ifndef __arch_use_vsyscall
29-
static __always_inline int __arch_use_vsyscall(struct vdso_data *vdata)
30-
{
31-
return 1;
32-
}
33-
#endif /* __arch_use_vsyscall */
34-
3528
#ifndef __arch_update_vsyscall
3629
static __always_inline void __arch_update_vsyscall(struct vdso_data *vdata,
3730
struct timekeeper *tk)

kernel/time/vsyscall.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,7 @@ void update_vsyscall(struct timekeeper *tk)
110110
nsec = nsec + tk->wall_to_monotonic.tv_nsec;
111111
vdso_ts->sec += __iter_div_u64_rem(nsec, NSEC_PER_SEC, &vdso_ts->nsec);
112112

113-
if (__arch_use_vsyscall(vdata))
114-
update_vdso_data(vdata, tk);
113+
update_vdso_data(vdata, tk);
115114

116115
__arch_update_vsyscall(vdata, tk);
117116

@@ -124,10 +123,8 @@ void update_vsyscall_tz(void)
124123
{
125124
struct vdso_data *vdata = __arch_get_k_vdso_data();
126125

127-
if (__arch_use_vsyscall(vdata)) {
128-
vdata[CS_HRES_COARSE].tz_minuteswest = sys_tz.tz_minuteswest;
129-
vdata[CS_HRES_COARSE].tz_dsttime = sys_tz.tz_dsttime;
130-
}
126+
vdata[CS_HRES_COARSE].tz_minuteswest = sys_tz.tz_minuteswest;
127+
vdata[CS_HRES_COARSE].tz_dsttime = sys_tz.tz_dsttime;
131128

132129
__arch_sync_vdso_data(vdata);
133130
}

0 commit comments

Comments
 (0)