* [PATCH] lib/vdso: use CLOCK_REALTIME_COARSE for time()
@ 2020-06-11 15:57 Mark Salyzyn
2020-06-11 19:34 ` Thomas Gleixner
0 siblings, 1 reply; 3+ messages in thread
From: Mark Salyzyn @ 2020-06-11 15:57 UTC (permalink / raw)
To: linux-kernel
Cc: kernel-team, Chiawei Wang, Mark Salyzyn, stable, Andy Lutomirski,
Thomas Gleixner, Vincenzo Frascino
From: Chiawei Wang <chiaweiwang@google.com>
CLOCK_REALTIME in vdso data won't be updated if
__arch_use_vsyscall() returns false. It will let time()
return an incorrect time value. Since time() is designed
to return the seconds since the Epoch, using
CLOCK_REALTIME_COARSE can still fulfill the request and
never fails.
Signed-off-by: Chiawei Wang <chiaweiwang@google.com>
Signed-off-by: Mark Salyzyn <salyzyn@android.com>
Cc: linux-kernel@vger.kernel.org
Cc: kernel-team@android.com
Cc: stable@vger.kernel.org # 5.4+
---
lib/vdso/gettimeofday.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/vdso/gettimeofday.c b/lib/vdso/gettimeofday.c
index a2909af4b924..7ea22096cbe2 100644
--- a/lib/vdso/gettimeofday.c
+++ b/lib/vdso/gettimeofday.c
@@ -324,7 +324,7 @@ __cvdso_time_data(const struct vdso_data *vd, __kernel_old_time_t *time)
vd->clock_mode == VDSO_CLOCKMODE_TIMENS)
vd = __arch_get_timens_vdso_data();
- t = READ_ONCE(vd[CS_HRES_COARSE].basetime[CLOCK_REALTIME].sec);
+ t = READ_ONCE(vd[CS_HRES_COARSE].basetime[CLOCK_REALTIME_COARSE].sec);
if (time)
*time = t;
--
2.27.0.278.ge193c7cf3a9-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] lib/vdso: use CLOCK_REALTIME_COARSE for time()
2020-06-11 15:57 [PATCH] lib/vdso: use CLOCK_REALTIME_COARSE for time() Mark Salyzyn
@ 2020-06-11 19:34 ` Thomas Gleixner
2020-06-11 19:47 ` Mark Salyzyn
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Gleixner @ 2020-06-11 19:34 UTC (permalink / raw)
To: Mark Salyzyn, linux-kernel
Cc: kernel-team, Chiawei Wang, Mark Salyzyn, stable, Andy Lutomirski,
Vincenzo Frascino
Mark Salyzyn <salyzyn@android.com> writes:
> From: Chiawei Wang <chiaweiwang@google.com>
>
> CLOCK_REALTIME in vdso data won't be updated if
> __arch_use_vsyscall() returns false.
Errm!
# git grep __arch_use_vsyscall
#
Aside of that update_vsyscall() updates CLOCK_REALTIME data
unconditionally. No idea what this patch is solving.
> Cc: stable@vger.kernel.org # 5.4+
This # 5.4+ is pointless. You really want to add a fixes tag which pin
points the commit which introduced the wreckage.
But thats moot as this is not fixing anything not even in 5.4.
I assume this was developed against some Frankenkernel which has a messy
backport or a snapshot of some development version of that vdso stuff.
Not that I want to know, but please make sure that something you send my
way makes sense on sane kernels.
Oh well.
Thanks,
tglx
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] lib/vdso: use CLOCK_REALTIME_COARSE for time()
2020-06-11 19:34 ` Thomas Gleixner
@ 2020-06-11 19:47 ` Mark Salyzyn
0 siblings, 0 replies; 3+ messages in thread
From: Mark Salyzyn @ 2020-06-11 19:47 UTC (permalink / raw)
To: Thomas Gleixner
Cc: linux-kernel, kernel-team, Chiawei Wang, stable, Andy Lutomirski,
Vincenzo Frascino
On Jun 11, 2020, at 12:34 PM, Thomas Gleixner <tglx@linutronix.de> wrote:
>
> Mark Salyzyn <salyzyn@android.com> writes:
>> From: Chiawei Wang <chiaweiwang@google.com>
>>
>> CLOCK_REALTIME in vdso data won't be updated if
>> __arch_use_vsyscall() returns false.
>
> Errm!
>
> # git grep __arch_use_vsyscall
> #
>
> Aside of that update_vsyscall() updates CLOCK_REALTIME data
> unconditionally. No idea what this patch is solving.
>
>> Cc: stable@vger.kernel.org # 5.4+
>
> This # 5.4+ is pointless. You really want to add a fixes tag which pin
> points the commit which introduced the wreckage.
>
> But thats moot as this is not fixing anything not even in 5.4.
>
> I assume this was developed against some Frankenkernel which has a messy
> backport or a snapshot of some development version of that vdso stuff.
Yes, problem code was removed with 52338415cf4d4064ae6b8dd972dadbda841da4fa not applied.
4.19 back port without time namespaces, chip vendor using __arch_use_vsyscall to solve a chip errata.
>
> Not that I want to know, but please make sure that something you send my
> way makes sense on sane kernels.
>
> Oh well.
>
> Thanks,
>
> tglx
Sorry for your troubles.
Sincerely — Mark Salyzyn
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-06-11 19:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-11 15:57 [PATCH] lib/vdso: use CLOCK_REALTIME_COARSE for time() Mark Salyzyn
2020-06-11 19:34 ` Thomas Gleixner
2020-06-11 19:47 ` Mark Salyzyn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox