From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 96B7B3E5589 for ; Mon, 20 Jul 2026 14:03:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784556232; cv=none; b=OV88VFQhIVi5gLF/Gx4A7VCn59EkRJHo1nd+an1eBPkGpO6lDtI5/1M5Fx1+6Kq19J24E1bkWJa3AUZ/bhYjaMt2W4SaXRwoNkQ6672EB9o/Us8QiP6gSdRbIAziltujkt20xoiusGet1XC/Gp25BRdIAdA3TKPVoE7RFPR9/o4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784556232; c=relaxed/simple; bh=shYc1bUa0B+lrF+1JFMUIieSuCgOsyaIWaW2A1GmF7M=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=H5+SmrwKwg1dl0sPvMPj20UJl6Kd5pUgS5pemwrp4wz4t0Qf3FVDfCzIjFbSUxRdYVh5R3q5MzA+5Lq3WB1qQvuOY9bZQEcMYUyJtnqvwaisxGighCpVfBSwBu5eBMmA3LfqjyLmP+AdhNtHIhxlCpPqWkd0thfRaZj6g22Sc88= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=D2MNfSlt; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Amg0kkq+; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="D2MNfSlt"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Amg0kkq+" From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1784556229; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=VBCWBruNcLoMPvGhWXCiAQPQUHXaPUhHldCQfCX3+/Y=; b=D2MNfSltomuFbQ1NXqq2vgeqrDTN2fE2IFbnnznvLCjC48uotkwKt2bYJ6vhinIYknTG2c rDTmkmTuvGAg8s6BtF828YaZHzmscNitakDGV939x+tTGGG3aPwpzj5xgCxo/+Q6JWLNPH RXhKrM6hGwOmAG2iTosK3GfmHE8Ta3jQdMPupg4D4SSXSsPtMvt6C4/AQiV5352I32uwKC KJDm5muNOYTqaZlkHRQrwunWPxubkcon3q4JLOcrEw7lncXZAbng9WbSGbcKd0cDJ6kyPx f0U+fDeNaUyTrAklcpo5Qzo24Zov6tkRPr7gW79QplmejtF4JGYBZVNok8wFiA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1784556229; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=VBCWBruNcLoMPvGhWXCiAQPQUHXaPUhHldCQfCX3+/Y=; b=Amg0kkq+v5A9LL9ZY60GDDas5UVSd1kubnkJ1Zx7Zpibgo270py/0z+doxPOK5iWADpeR1 2Hz3FNZISrinWcAQ== To: Dennis Moshegov Cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH] timekeeping: Use data_race() and READ_ONCE() in ktime_get_real_seconds() In-Reply-To: References: <874ijl8eb8.ffs@fw13> <871peo9485.ffs@fw13> <87a4som3sj.ffs@fw13> Date: Mon, 20 Jul 2026 16:03:48 +0200 Message-ID: <87ik69n4fv.ffs@fw13> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Mon, Jul 20 2026 at 09:40, Dennis Moshegov wrote: > From: Dennis M This from line mail address is not matching the > Subject: [PATCH v3] 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 one used here. Please make your mind up which of your personalities you awant to use. > --- > timekeeping.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c > index c493a40..461a68e 100644 > --- a/kernel/time/timekeeping.c > +++ b/kernel/time/timekeeping.c > @@ -826,6 +826,7 @@ static void timekeeping_update_from_shadow(struct > tk_data *tkd, unsigned int action) > * the cacheline optimized data layout of the timekeeper and requires > * another indirection. > */ > + WRITE_ONCE(tkd->timekeeper.xtime_secy, tk->xtime_sec); > memcpy(&tkd->timekeeper, tk, sizeof(*tk)); > write_seqcount_end(&tkd->seq); Again you used copy & paste to get the patch into your mail client or imported it and gmail mangled it. patching file kernel/time/timekeeping.c patch: **** malformed patch at line 34: tk_data *tkd, unsigned int action) See Documentation/process/email-clients.rst The only known way to send patches with the gmail web client is as attachment, but that's a pain for reviewing, replying and applying. But you can use git send-email with gmail smtp and that will do the right thing. Thanks, tglx