summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorgkoehler <gkoehler@cvs.openbsd.org>2020-07-17 01:36:42 +0000
committergkoehler <gkoehler@cvs.openbsd.org>2020-07-17 01:36:42 +0000
commit1b54105f6a84816f0d15212caa903c46b79ffa1f (patch)
tree67261fbd844eaf96316883e6e20da55090676547 /sys
parent9116cd254a15da199a1541cff563105e4751a04a (diff)
Read ogen from the other timehands; fixes tk_generation
If th0.th_generation == th1.th_generation when we update the user timekeep page, then tk_generation doesn't change, so libc may calculate the wrong time. Now th0 and th1 share the sequence so th0.th_generation != th1.th_generation. ok kettenis@ cheloha@
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_tc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c
index 1e2ec60a15f..2061bd1314f 100644
--- a/sys/kern/kern_tc.c
+++ b/sys/kern/kern_tc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_tc.c,v 1.63 2020/07/16 23:06:43 cheloha Exp $ */
+/* $OpenBSD: kern_tc.c,v 1.64 2020/07/17 01:36:41 gkoehler Exp $ */
/*
* Copyright (c) 2000 Poul-Henning Kamp <phk@FreeBSD.org>
@@ -575,8 +575,8 @@ tc_windup(struct bintime *new_boottime, struct bintime *new_offset,
* the contents, the generation must be zero.
*/
tho = timehands;
+ ogen = tho->th_generation;
th = tho->th_next;
- ogen = th->th_generation;
th->th_generation = 0;
membar_producer();
memcpy(th, tho, offsetof(struct timehands, th_generation));