From: Thomas Gleixner <tglx@linutronix.de>
To: Dennis Moshegov <dennis@xzync.uk>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] timekeeping: Use data_race() and READ_ONCE() in ktime_get_real_seconds()
Date: Sun, 21 Jun 2026 15:17:00 +0200 [thread overview]
Message-ID: <87a4som3sj.ffs@fw13> (raw)
In-Reply-To: <CAGqVGMoOYr+6pKKCnOpjOD_GSWp6+=uqE2krz1NJhrn2BmAiRg@mail.gmail.com>
On Tue, Jun 16 2026 at 10:11, Dennis Moshegov wrote:
> From: Dennis M <dennismoshegov@gmail.com>
> Subject: [PATCH v2] timekeeping: Use READ_ONCE/WRITE_ONCE for
> xtime_sec to prevent tearing
>
> The timekeeper update path uses a bulk memcpy() to
> synchronize the timekeeper structure, which is not guaranteed to be atomic.
> This allows for torn reads in ktime_get_real_seconds() on 64-bit systems,
> where the sequence counter protection is bypassed for performance.
>
> To prevent reading a torn 64-bit xtime_sec value, enforce atomic-like
> access by using WRITE_ONCE() for the critical field before the bulk
> memcpy() in timekeeping_update_from_shadow(). Correspondingly, use
> READ_ONCE() in ktime_get_real_seconds() to ensure a fresh, consistent
> load from memory.
>
> Reported-by: syzbot+72789cd1697965e714ca@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspotmail.com/bug?extid=72789cd1697965e714ca
> Signed-off-by: Dennis Moshegov <dennis@xzync.uk>
> ---
> timekeeping.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/timekeeping.c b/timekeeping.c
> index c493a40..461a68e 100644
> --- a/timekeeping.c
> +++ b/timekeeping.c
You need to create the patch in the top level directory so that this
becomes a/kernel/time/timekeeping.c
> @@ -826,6 +826,7 @@ static void timekeeping_update_from_shadow(struct
> tk_data *tkd, unsigned int act
There is a line break after 'struct', which makes the patch malformed
and it can't be applied as is.
Thanks,
tglx
prev parent reply other threads:[~2026-06-21 13:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-30 17:38 [PATCH] timekeeping: Use data_race() and READ_ONCE() in ktime_get_real_seconds() Dennis Moshegov
2026-06-02 9:46 ` Thomas Gleixner
[not found] ` <CAGqVGMp6z7VHvD6YGhgAL+2mffvM7FoFY1F__Xa2-u98YZRYeQ@mail.gmail.com>
[not found] ` <871peo9485.ffs@fw13>
[not found] ` <CAGqVGMrdhhVdCOQxNLtFkrDbeeEytJiiY+=2D7VYMue0xDD8DQ@mail.gmail.com>
2026-06-16 9:11 ` Dennis Moshegov
2026-06-21 13:17 ` Thomas Gleixner [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a4som3sj.ffs@fw13 \
--to=tglx@linutronix.de \
--cc=dennis@xzync.uk \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox