From: "tip-bot2 for Paul E. McKenney" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: "Paul E. McKenney" <paulmck@kernel.org>,
Thomas Gleixner <tglx@kernel.org>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: timers/core] timers: Mark racy updates to hlist_node::pprev field
Date: Tue, 29 Sep 2026 19:11:17 -0000 [thread overview]
Message-ID: <179070907745.3910103.4729382723879149495.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20260919002523.3133928-1-paulmck@kernel.org>
The following commit has been merged into the timers/core branch of tip:
Commit-ID: 1159ad0a6aaa414dc726a33ccdcb702752d1b8eb
Gitweb: https://git.kernel.org/tip/1159ad0a6aaa414dc726a33ccdcb702752d1b8eb
Author: Paul E. McKenney <paulmck@kernel.org>
AuthorDate: Fri, 18 Sep 2026 17:25:22 -07:00
Committer: Thomas Gleixner <tglx@kernel.org>
CommitterDate: Tue, 29 Sep 2026 21:07:15 +02:00
timers: Mark racy updates to hlist_node::pprev field
hlist_unhashed_lockless() locklessly samples the hlist_node structure's
pprev field, but detach_timer(), hlist_move_list(), and hlist_splice_init()
all use plain C-language stores to update this field, despite the "The
READ_ONCE() is paired with the various WRITE_ONCE() in hlist helpers that
are defined below" in the hlist_unhashed_lockless() header comment.
Therefore use WRITE_ONCE() for these hlist_node::pprev updates.
KCSAN located this issue.
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Link: https://patch.msgid.link/20260919002523.3133928-1-paulmck@kernel.org
---
include/linux/list.h | 6 +++---
kernel/time/timer.c | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/linux/list.h b/include/linux/list.h
index 77fb62f..e375369 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -1172,7 +1172,7 @@ static inline void hlist_move_list(struct hlist_head *old,
{
new->first = old->first;
if (new->first)
- new->first->pprev = &new->first;
+ WRITE_ONCE(new->first->pprev, &new->first);
old->first = NULL;
}
@@ -1189,10 +1189,10 @@ static inline void hlist_splice_init(struct hlist_head *from,
struct hlist_head *to)
{
if (to->first)
- to->first->pprev = &last->next;
+ WRITE_ONCE(to->first->pprev, &last->next);
last->next = to->first;
to->first = from->first;
- from->first->pprev = &to->first;
+ WRITE_ONCE(from->first->pprev, &to->first);
from->first = NULL;
}
diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index ae9abf1..42afdcb 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -890,7 +890,7 @@ static inline void detach_timer(struct timer_list *timer, bool clear_pending)
__hlist_del(entry);
if (clear_pending)
- entry->pprev = NULL;
+ WRITE_ONCE(entry->pprev, NULL);
entry->next = LIST_POISON2;
}
next prev parent reply other threads:[~2026-09-29 19:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-19 0:24 [PATCH RFC] Fix data races in timers Paul E. McKenney
2026-09-19 0:25 ` [PATCH 1/2] timers: Mark updates to hlist_node ->pprev field Paul E. McKenney
2026-09-29 19:11 ` tip-bot2 for Paul E. McKenney [this message]
2026-09-19 0:25 ` [PATCH 2/2] timers/migration: Mark updates to tmigr_event ->field Paul E. McKenney
2026-09-29 19:11 ` [tip: timers/core] timers/migration: Mark racy updates to tmigr_event::ignore field tip-bot2 for Paul E. McKenney
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=179070907745.3910103.4729382723879149495.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=tglx@kernel.org \
--cc=x86@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
all inboxes | Powered by JetHome®