public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Ben Hutchings <ben@decadent.org.uk>
To: stable@vger.kernel.org
Cc: Lee Jones <lee.jones@linaro.org>,
	"Luis Claudio R. Goncalves" <lgoncalv@redhat.com>,
	Florian Fainelli <f.fainelli@gmail.com>
Subject: [PATCH 01/13] futex: Use smp_store_release() in mark_wake_futex()
Date: Sun, 28 Mar 2021 22:40:54 +0200	[thread overview]
Message-ID: <YGDp1qJOCUJmE1Ty@decadent.org.uk> (raw)

[-- Attachment #1: Type: text/plain, Size: 1257 bytes --]

From: Peter Zijlstra <peterz@infradead.org>

commit 1b367ece0d7e696cab1c8501bab282cc6a538b3f upstream.

Since the futex_q can dissapear the instruction after assigning NULL,
this really should be a RELEASE barrier. That stops loads from hitting
dead memory too.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: juri.lelli@arm.com
Cc: bigeasy@linutronix.de
Cc: xlpang@redhat.com
Cc: rostedt@goodmis.org
Cc: mathieu.desnoyers@efficios.com
Cc: jdesfossez@efficios.com
Cc: dvhart@infradead.org
Cc: bristot@redhat.com
Link: http://lkml.kernel.org/r/20170322104151.604296452@infradead.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 kernel/futex.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/futex.c b/kernel/futex.c
index 796b1c860839..e112a9d4c84f 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -1565,8 +1565,7 @@ static void mark_wake_futex(struct wake_q_head *wake_q, struct futex_q *q)
 	 * memory barrier is required here to prevent the following
 	 * store to lock_ptr from getting ahead of the plist_del.
 	 */
-	smp_wmb();
-	q->lock_ptr = NULL;
+	smp_store_release(&q->lock_ptr, NULL);
 }
 
 /*


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

             reply	other threads:[~2021-03-28 20:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-28 20:40 Ben Hutchings [this message]
2021-03-28 20:41 ` [PATCH 02/13] futex,rt_mutex: Introduce rt_mutex_init_waiter() Ben Hutchings
2021-03-28 20:41 ` [PATCH 03/13] futex: Rework futex_lock_pi() to use rt_mutex_*_proxy_lock() Ben Hutchings
2021-03-28 20:41 ` [PATCH 04/13] futex: Drop hb->lock before enqueueing on the rtmutex Ben Hutchings
2021-03-28 20:42 ` [PATCH 05/13] futex: Avoid freeing an active timer Ben Hutchings
2021-03-28 20:42 ` [PATCH 06/13] futex,rt_mutex: Fix rt_mutex_cleanup_proxy_lock() Ben Hutchings
2021-03-28 20:42 ` [PATCH 07/13] futex: Handle early deadlock return correctly Ben Hutchings
2021-03-28 20:42 ` [PATCH 08/13] futex: Fix (possible) missed wakeup Ben Hutchings
2021-03-28 20:42 ` [PATCH 09/13] locking/futex: Allow low-level atomic operations to return -EAGAIN Ben Hutchings
2021-03-28 20:42 ` [PATCH 10/13] arm64: futex: Bound number of LDXR/STXR loops in FUTEX_WAKE_OP Ben Hutchings
2021-03-28 20:42 ` [PATCH 11/13] futex: Prevent robust futex exit race Ben Hutchings
2021-03-28 20:43 ` [PATCH 12/13] futex: Fix incorrect should_fail_futex() handling Ben Hutchings
2021-03-28 20:43 ` [PATCH 13/13] futex: Handle transient "ownerless" rtmutex state correctly Ben Hutchings
2021-03-29  5:50 ` [PATCH 01/13] futex: Use smp_store_release() in mark_wake_futex() Greg KH

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=YGDp1qJOCUJmE1Ty@decadent.org.uk \
    --to=ben@decadent.org.uk \
    --cc=f.fainelli@gmail.com \
    --cc=lee.jones@linaro.org \
    --cc=lgoncalv@redhat.com \
    --cc=stable@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