From patchwork Tue Nov 14 21:56:46 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: 165103 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:a59:b0:164:83eb:24d7 with SMTP id 25csp2226532rwb; Tue, 14 Nov 2023 13:57:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IHByIiGpB4cvWHSblNz7jZ68hMdcOhkBQCJ5NIBKuEvQYZvF965AWBEirnl3txgMmuKnt9m X-Received: by 2002:a05:6a20:4c86:b0:180:febc:8ecb with SMTP id fq6-20020a056a204c8600b00180febc8ecbmr7191399pzb.54.1699999033651; Tue, 14 Nov 2023 13:57:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699999033; cv=none; d=google.com; s=arc-20160816; b=cgsSejMu9ceUxVEVv+4PPkF2O1SqjqWHA8v/J8VKtmXHW2rfcsaPuTIqSwbDiTJVMR PmhEGicHbRfhs/rB2xsQf4RQYwLHcE9XVI5EprEU3Ezr6w+CXBAojkyfSeN8wIpsOIvG dUOzgBbvR1QOl+pFZEafbB3PK1SHf1JpSpcm4wlQP1Mv5uh98//orQKf9n6oOE3PB9vO X7iJOX21LhqEjmPHikTOM6tAbzqDFAh+vW6Jo/Usz1CHRwKLeVOkG0feNHA+l3/5XKRg c2t06ZyIqsoZ+/qpWgDRK+uvzqlzxP/G3PmYxRDz8ura+a4ebZxT/5dsXjz//gOs2X17 //0A== 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=vInrZ1jYOgBJhGzvcL4J/hkNuIxeYyfms/Z6oqeyhq0=; fh=MlapAvMeN8/0cKSOZcl/Qncw5B5kp4SBarTiURMBDkA=; b=kwlWQ5LnDMM5wY4If6+0VgEvQsHd+bAZ4k1xQ9zLMS3ILrttyvewjE3LU+kc3yIKL1 QrC6jzhDNiJILQS2crOpz+RdGXUv/UlTYpnaLKSp/d0DujPiNxdAf1Capm/eT/ZDhmgk 6tJ9l9os9aHC/vx206TULShfYzdIPB+SVOhGeKccaQBRMa6naZuxbMTtZ475PxEU1nye u6xmUHx3rCBfhqsC5TYgkPqfQbYQ27957HvPoVSIa9cdud3McgpGnCM6JUclc+LIvIAv q302Yr+GsTqIvw4fxWHQ38JtOG4G8iDfO08Hb8jwG+NwvbLc89TZs8w37w1goMu+jvH6 rooA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=i27GDA64; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=gIrSZFKs; 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 c1-20020a170902aa4100b001c427a74e31si8195680plr.628.2023.11.14.13.57.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 13:57:13 -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=i27GDA64; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=gIrSZFKs; 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 476BB8032C69; Tue, 14 Nov 2023 13:57:10 -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 S233930AbjKNV44 (ORCPT + 29 others); Tue, 14 Nov 2023 16:56:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229569AbjKNV4y (ORCPT ); Tue, 14 Nov 2023 16:56:54 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B367D3; Tue, 14 Nov 2023 13:56:50 -0800 (PST) Date: Tue, 14 Nov 2023 21:56:46 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1699999007; 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=vInrZ1jYOgBJhGzvcL4J/hkNuIxeYyfms/Z6oqeyhq0=; b=i27GDA64/eBNcBzluVesMvqmC0WT30/jPwHu7GLvKTfQerNr5F84dipvaCZhYFOqkriheS dsjHOXzcmeyw2ZqsCrNNJq7D3xkQQ5yKXYwJVs2lxilI19nuyigv2cDD47mVb3TYCcuxHK GnmvUQQ8oQAqWsVJn8YZZd9UVcRqk8xapQfFgIaoSSqd4i9V/+epw8gZLiQPo2fZVbwqf3 1ypHEAsWl+fcpDPt9Iynhp6WaMDFekbqpy6/ev/W6EGBGVHwfe45bLMQnf8yfodnR4iVOE PisjK95PdoDEFhD4zJZkO+HIqQ13X8+qrMCnV8gJmhGLGoUsZTXDz/Ip9dOGZA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1699999007; 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=vInrZ1jYOgBJhGzvcL4J/hkNuIxeYyfms/Z6oqeyhq0=; b=gIrSZFKsLRz2OWqUo1CVdVssIuBiNJu6VMcbF1mjNXebNM/QTPUquSu1WzTwgso4vbQ5r6 4rSshQRT1r04yZCA== 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)" , 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: <169999900615.391.871692364626596753.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 13:57:10 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782578186663093791 X-GMAIL-MSGID: 1782578186663093791 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 AuthorDate: Tue, 14 Nov 2023 21:36:13 +01:00 Committer: Peter Zijlstra 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 Reported-by: Florian Weimer Signed-off-by: Peter Zijlstra (Intel) 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; }