From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 205B1288505 for ; Fri, 31 Jul 2026 00:40:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785458425; cv=none; b=Czv65FYt/AtykDMBz/OmoiVUXUq1xyZVUVEEaxOm9DoK4krsF02WuZRL3klyLsqZ2DtzIxHYtxjCPRrvKq2+NT0I5zeysIVExAvuPEMnSKclXT1zu5cbfh3nY8cWO0F93KgksYMu0bn9j0/DOlq1OD0hKeYHP6brR7mu9U5a/Ls= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785458425; c=relaxed/simple; bh=8f4fOos+5f5sOlUrZ2ymA2RW9kuiSGIIZbU7R7gH8as=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=rcXOkvp/7HbeoNBcSwqw6Jd8oGSYgrT0O4QdRYwHcZAOzAj6HtSShpzH92gL275vsdAjcGJM2LGrYsAd6Gv1Pd0nkZw7kFsCsvQvy47ms8LyfuItb521jykWR3fdTRT/xzglVI1GXrdY/h9DXeHWQVw/f/tGhurZg5PG72S07UI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=boqGVg0B; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="boqGVg0B" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB6201F01564; Fri, 31 Jul 2026 00:40:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1785458421; bh=gteLFBGCh7Bc5PKXyQhmzlAPEj0X8tPwWvfQTHS1dtE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=boqGVg0BPbl2ZbkHbR2zv0Y2XW97eFhYfrC7eYJ/hzn8riPnBDaB8Ol55hl9rS8WT kQAlIHOzFbFy6Ycec68rkxJWYOnCuBRZP9QPi8cKRO3G6TDNfmNcFDoEJEdI5ZqDK2 YX/vyP42N050FswWcho4HGK8tOlmJDpkX0P3QH4By/eB60n6aaDHRCe6dmVfaSuO0v oziXK8HhK8w0M9Sw/bO7uk7HXNkwpn4iiubolESC1II0EHsO5t04aK3OH5jYKPfLJ7 SY32cqBOMU6CCfKf7CQroGrkcaUnHT7YW9ueHzNsOLCRXyzaIkdj4S1f1FioUSKdXq 3wvpDQ7wSCJyw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 4C394CE14D9; Thu, 30 Jul 2026 17:40:21 -0700 (PDT) From: "Paul E. McKenney" To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner Cc: "Peter Zijlstra (Intel)" , linux-kernel@vger.kernel.org, kernel-team@meta.com, "Paul E. McKenney" , Ingo Molnar , Darren Hart , Davidlohr Bueso , =?UTF-8?q?Andr=C3=A9=20Almeida?= Subject: [PATCH RFC 9/9] futex: Use accessor for hrtimer_sleeper ->task field in requeue Date: Thu, 30 Jul 2026 17:40:19 -0700 Message-Id: <20260731004019.3530210-9-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The hrtimer_sleeper structure's ->task field is used as a flag to indicate that the associated hrtimer has expired. This means that the hrtimer handler can be storing to this field while other code is loading from it to check for expiry. Note that additional races appear for hrtimers that can be restarted, which could be argued to be a user error. However, that is no reason to let the compiler introduce additional confusion, and to this end, the hrtimer_sleeper_task_get() was introduced, use of which also has the benefit of avoiding open-code access to hrtimer_sleeper innards. Therefore, apply this accessor to handle_early_requeue_pi_wakeup(). KCSAN located this issue. Signed-off-by: Paul E. McKenney Cc: Ingo Molnar Cc: Peter Zijlstra Cc: Darren Hart Cc: Davidlohr Bueso Cc: "André Almeida" Cc: Anna-Maria Behnsen Cc: Frederic Weisbecker Cc: Thomas Gleixner --- kernel/futex/requeue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/futex/requeue.c b/kernel/futex/requeue.c index 79823ad136830a..196d6ff148a4d8 100644 --- a/kernel/futex/requeue.c +++ b/kernel/futex/requeue.c @@ -736,7 +736,7 @@ int handle_early_requeue_pi_wakeup(struct futex_hash_bucket *hb, /* Handle spurious wakeups gracefully */ ret = -EWOULDBLOCK; - if (timeout && !timeout->task) + if (timeout && !hrtimer_sleeper_task_get(timeout)) ret = -ETIMEDOUT; else if (signal_pending(current)) ret = -ERESTARTNOINTR; -- 2.40.1