Re: [RFC PATCH v2 07/10] lib: vdso: don't use READ_ONCE() in __c_kernel_time()
From: Thomas Gleixner <hidden>
Date: 2020-01-10 21:12:17
Also in:
linux-arm-kernel, linux-mips, lkml
From: Thomas Gleixner <hidden>
Date: 2020-01-10 21:12:17
Also in:
linux-arm-kernel, linux-mips, lkml
Christophe Leroy [off-list ref] writes:
diff --git a/lib/vdso/gettimeofday.c b/lib/vdso/gettimeofday.c index 17b4cff6e5f0..5a17a9d2e6cd 100644 --- a/lib/vdso/gettimeofday.c +++ b/lib/vdso/gettimeofday.c@@ -144,7 +144,7 @@ __cvdso_gettimeofday(const struct vdso_data *vd, struct __kernel_old_timeval *tv static __maybe_unused __kernel_old_time_t __cvdso_time(const struct vdso_data *vd, __kernel_old_time_t *time) { - __kernel_old_time_t t = READ_ONCE(vd[CS_HRES_COARSE].basetime[CLOCK_REALTIME].sec); + __kernel_old_time_t t = vd[CS_HRES_COARSE].basetime[CLOCK_REALTIME].sec; if (time) *time = t;
Allows the compiler to load twice, i.e. the returned value might be different from the
stored value. So no.
Thanks,
tglx