mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tip-bot2 for Peter Zijlstra" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Xi Ruoyao <xry111@xry111.site>,
	Florian Weimer <fweimer@redhat.com>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: locking/urgent] futex: Fix hardcoded flags
Date: Tue, 14 Nov 2023 21:56:46 -0000	[thread overview]
Message-ID: <169999900615.391.871692364626596753.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20231114201402.GA25315@noisy.programming.kicks-ass.net>

The following commit has been merged into the locking/urgent branch of tip:

Commit-ID:     59f3daffefbf48206dbf310af5472d6d7d7161df
Gitweb:        https://git.kernel.org/tip/59f3daffefbf48206dbf310af5472d6d7d7161df
Author:        Peter Zijlstra <peterz@infradead.org>
AuthorDate:    Tue, 14 Nov 2023 21:36:13 +01:00
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Tue, 14 Nov 2023 22:26:41 +01:00

futex: Fix hardcoded flags

Xi reported that commit 5694289ce183 ("futex: Flag conversion") broke
glibc's robust futex tests.

This was narrowed down to the change of FLAGS_SHARED from 0x01 to
0x10, at which point Florian noted that handle_futex_death() has a
hardcoded flags argument of 1.

Change this to: FLAGS_SIZE_32 | FLAGS_SHARED, matching how
futex_to_flags() unconditionally sets FLAGS_SIZE_32 for all legacy
futex ops.

Fixes: 5694289ce183 ("futex: Flag conversion")
Reported-by: Xi Ruoyao <xry111@xry111.site>
Reported-by: Florian Weimer <fweimer@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20231114201402.GA25315@noisy.programming.kicks-ass.net
---
 kernel/futex/core.c |  9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/kernel/futex/core.c b/kernel/futex/core.c
index 52695c5..dad981a 100644
--- a/kernel/futex/core.c
+++ b/kernel/futex/core.c
@@ -700,7 +700,8 @@ retry:
 	owner = uval & FUTEX_TID_MASK;
 
 	if (pending_op && !pi && !owner) {
-		futex_wake(uaddr, 1, 1, FUTEX_BITSET_MATCH_ANY);
+		futex_wake(uaddr, FLAGS_SIZE_32 | FLAGS_SHARED, 1,
+			   FUTEX_BITSET_MATCH_ANY);
 		return 0;
 	}
 
@@ -752,8 +753,10 @@ retry:
 	 * Wake robust non-PI futexes here. The wakeup of
 	 * PI futexes happens in exit_pi_state():
 	 */
-	if (!pi && (uval & FUTEX_WAITERS))
-		futex_wake(uaddr, 1, 1, FUTEX_BITSET_MATCH_ANY);
+	if (!pi && (uval & FUTEX_WAITERS)) {
+		futex_wake(uaddr, FLAGS_SIZE_32 | FLAGS_SHARED, 1,
+			   FUTEX_BITSET_MATCH_ANY);
+	}
 
 	return 0;
 }

  reply	other threads:[~2023-11-14 21:56 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4bda9f2e06512e375e045f9e72edb205104af19c.camel@xry111.site>
2023-11-14  9:46 ` Several tst-robust* tests time out with recent Linux kernel Xi Ruoyao
2023-11-14 15:31   ` Peter Zijlstra
2023-11-14 15:40     ` Peter Zijlstra
2023-11-14 16:43       ` Florian Weimer
2023-11-14 20:14         ` Peter Zijlstra
2023-11-14 21:56           ` tip-bot2 for Peter Zijlstra [this message]
2023-11-15  1:11           ` Edgecombe, Rick P
2023-11-15  8:51             ` Peter Zijlstra
2023-11-15 23:28               ` Edgecombe, Rick P
2023-11-17  1:22                 ` Edgecombe, Rick P
2024-01-19 13:56                   ` Stefan Liebler
2024-01-29 22:23                     ` Edgecombe, Rick P
2024-01-30 10:12                       ` Stefan Liebler
2023-11-15  3:07           ` [tip: locking/urgent] futex: Fix hardcoded flags tip-bot2 for Peter Zijlstra

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=169999900615.391.871692364626596753.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=fweimer@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=x86@kernel.org \
    --cc=xry111@xry111.site \
    /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®