From patchwork Wed Nov 15 03:07:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 165159 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:a59:b0:164:83eb:24d7 with SMTP id 25csp2357405rwb; Tue, 14 Nov 2023 19:09:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IEsNw0EHiL6zrF63ZTSySgsc4cVZd2+bnhRf+7DkSQU35t6udfqDwF2viceYj16zen1Xxq3 X-Received: by 2002:a17:90b:1a91:b0:27d:166b:40f6 with SMTP id ng17-20020a17090b1a9100b0027d166b40f6mr9345473pjb.41.1700017743703; Tue, 14 Nov 2023 19:09:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700017743; cv=none; d=google.com; s=arc-20160816; b=yh2W5IzYUAer6TafZ6XwcsMitFVnUTCkyHeJ6ntHcazukWLRmM5nxuMKhGe4WpwjRW reVkkvopiOnpn8l+m0J2HvOhPNFALFHYCzkl64GywN7N4nr9lAueHW1VQ51zDZBV80lX /i1d9k5ZsMpVEPTsYRwWAY3eIhWWcqDFHaMmSXVnfPGaiyGfGDp34Ii9lNhYW+EptVhf xhg/Ij6hjpoRhI2i8CLkc3GoQdrYYOU4ofoSdgZaUEdvFBNjI+gW8NUuV5+6fMdGZ8GQ E+42tho+dYkHc3obsWMESHMY1Dd7vY2TWZmsgNHRHmoYuDbc13edIHAXWhxzV9PlkUgD HlFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=XFLN1xMKoqdzRw2wzV2uNrNhBJ7V/n9kgwDlpjXIqLk=; fh=btPL1i47ZKw7XX3oTS1wxRdcGbapk0MwjMTiKamNfMc=; b=FI++U8w3dUX1rfRWoikpdCLWsYkdZqD6MIplayFp0kE4zMWLBcr66Oebmp8j0X153h ZzExmIHpR/qXYeRWbKaLIRqaqzV30A1qpJXGA+A6Yxz7GwObTqfie1rF7VUHRzPIZEsY BRMEYfrBWBYyCrhqvAuLRqAMfZAwVZsP/Uv4EZWLxZT5F82QRiAbrq2Tz288QUx4DzWR Kc2J0pZWYG/tqS5zHQdnfzEH9cDN3joL9DghaS8o2vxV9KVjFM4/0tl12osCfegI4Zcg EiOcUlKugghuocIWXBAUqufD8FWSL2RogTBGDRCC7wBEJnD53vWhQezH3iUTAdWs7rrn Hr6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Ca0uGTDM; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id c8-20020a17090ab28800b00274a22e6364si13447396pjr.92.2023.11.14.19.09.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 19:09:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Ca0uGTDM; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 65FFB80CBF0D; Tue, 14 Nov 2023 19:09:01 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234420AbjKODId (ORCPT + 28 others); Tue, 14 Nov 2023 22:08:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234416AbjKODIR (ORCPT ); Tue, 14 Nov 2023 22:08:17 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A0EA183; Tue, 14 Nov 2023 19:07:49 -0800 (PST) Date: Wed, 15 Nov 2023 03:07:45 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1700017666; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XFLN1xMKoqdzRw2wzV2uNrNhBJ7V/n9kgwDlpjXIqLk=; b=Ca0uGTDMmjpfcC1TCfqlkpI9HGIsscHOkAMA/vRmncglxdPmaYQporVbZPeUNGd4PA8Ei9 Q3e4w1zBmjnR9pommhRAP1+SRDAIoJ1tZVpA1c4BpiJYwzMoIFhugKIf59jl+61pRrBDu8 BQQ9qYobeqUBUbRpipC8NsyBMm+rGqWJl4sO95SqYZM6dIK6/VRu3KI4AGMVxdNtFZOm9C jXRUo6fVPQDo8snY7AKwJgewgrXEa0uRGtaFaBjw5WFRqrPJCSM+jrUimeNdn9anFuKcUD c0lOAEZzmuosCKd7im/1xpO/d5NXF4neJk3m/VhJHVAXDBz9mOEv8Aw7KAajAw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1700017666; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XFLN1xMKoqdzRw2wzV2uNrNhBJ7V/n9kgwDlpjXIqLk=; b=X2rtJXQAigHHtmbkEqxVigAA18G9/ZsjVHH3DFHh3D+in6ZCvAJ/YypuSaMq0DmB4nRMRG Fb8OntQRFraulSBg== From: "tip-bot2 for Peter Zijlstra" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: locking/urgent] futex: Fix hardcoded flags Cc: Xi Ruoyao , Florian Weimer , "Peter Zijlstra (Intel)" , Ingo Molnar , , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231114201402.GA25315@noisy.programming.kicks-ass.net> References: <20231114201402.GA25315@noisy.programming.kicks-ass.net> MIME-Version: 1.0 Message-ID: <170001766579.391.5243762310659751499.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 14 Nov 2023 19:09:01 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782578186663093791 X-GMAIL-MSGID: 1782597805407105068 The following commit has been merged into the locking/urgent branch of tip: Commit-ID: c9bd1568d5462f4108417518ce1af7b924acfb6f Gitweb: https://git.kernel.org/tip/c9bd1568d5462f4108417518ce1af7b924acfb6f Author: Peter Zijlstra AuthorDate: Tue, 14 Nov 2023 21:36:13 +01:00 Committer: Ingo Molnar CommitterDate: Wed, 15 Nov 2023 04:02:25 +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. Reported-by: Xi Ruoyao Reported-by: Florian Weimer Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Ingo Molnar Link: https://lkml.kernel.org/r/20231114201402.GA25315@noisy.programming.kicks-ass.net Fixes: 5694289ce183 ("futex: Flag conversion") Cc: --- 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; }