Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5369855rwb; Mon, 14 Nov 2022 03:46:22 -0800 (PST) X-Google-Smtp-Source: AA0mqf5TsPQRDV+XDYaUbHWjHBE3bAgJUdcr1xWvjfErFKjcM1ZXfxjmvm/P1IHbsLRfHZ+rumui X-Received: by 2002:a63:535e:0:b0:46f:98cf:3bb6 with SMTP id t30-20020a63535e000000b0046f98cf3bb6mr11425678pgl.332.1668426382408; Mon, 14 Nov 2022 03:46:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426382; cv=none; d=google.com; s=arc-20160816; b=S6awykAw3aYB/ac4yypk0lrhw6M9a6FfmIuL7A8RfdQjth6fcMWbz4IzkCG3jG4GSK AoqE52CvBFv51Yp3p7K4pBaPaHy+OH4+DGdIENR4Eetd8HqdVE+b7+sBqNRl8RJxPZI5 SCefbrTj4bcpi77eWb+k4lUUMyWDtAUXiCu1ds2C8y9CwTCJVi9vxjugPSFQNMTth9gq f/q8VhZPX0f/cdNwKVc6tfkY6l4Lk00jNgBR9qxxo+mvUbE2DTubtuxMLiob1bVXBQ7o 5b5kfWKpGVWp4IP7oHuBZ2bu0ug1Jyfu7WxgHAKBQX00Lu25zVed36dlLk+EuhKQEyKo 831A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=43CxAXBLLYgE1DbXFL71Q2aYCGQ6icUba5GaNeZ6VQg=; b=MvD7BaKkq40FPnQSXGwzluNK0zLdaDyVJjGetk88s+HvBOlfkFU+4tGNrEwHR66TEH 4F1TkLsN546R61/Tzv3BLSkYMrwU/Z/jYUFTV1qM34qv12CMP03piSc54d2zRXqI84yo NEyEWVbDsf6x5mTmku0CWKUxVkJMKtl4YAOwHTX4f25v30SLIRdbVAuzOEwiaJlrjNii PoM+RmxO7FXfWNsTAaRKL4NLDaGpLVHbF5cVwDfVuftgzeH3Dbj+UQqd7rETIk+ePr2D Wy7I1vUv2mDVswj+2F7ocDmKV9zTm4j9kebHVYMMjEloXLkuO7geqG+ZRu3VMklG95l7 qpnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=qMu6ZglD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e1-20020a17090ac20100b00213ef843bdasi8767683pjt.64.2022.11.14.03.46.10; Mon, 14 Nov 2022 03:46:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=qMu6ZglD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236152AbiKNLiQ (ORCPT + 89 others); Mon, 14 Nov 2022 06:38:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235840AbiKNLiN (ORCPT ); Mon, 14 Nov 2022 06:38:13 -0500 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5414013CCF for ; Mon, 14 Nov 2022 03:38:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=43CxAXBLLYgE1DbXFL71Q2aYCGQ6icUba5GaNeZ6VQg=; b=qMu6ZglD8IPj//yaWoUWTch116 GUf/RjCnebWPAxHq5tXoF58K9QbQ08xN6DLo1BdA6kXnjNZwDsR0lSAp1gsKHqnsqh2Z/PtOXju2m EibTuCqb/pkcqjSViQ0KhbEACK8HmRaXGcp5Zvfn/u89jlAtQL98EbuZeU7BgBL595qhkc4FAow5N YLaqGvzyXOCVyFNmtM+QfknqgBUZnsDmcA8gRia+Tg2onWBp39udxXQuBFXIkQs34pVfo8MztMyMG Og3vsjxrI+X4Pln+MEDViNgs2/NpKilQeIQl70aEQSjWuu+8qUZf5gasZc2PK7FIoRbbSHcHd5yao 4wyQuNmg==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1ouXmP-000ome-6R; Mon, 14 Nov 2022 11:37:33 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id B6EF83001FD; Mon, 14 Nov 2022 12:37:31 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 91B0A20ABE4A8; Mon, 14 Nov 2022 12:37:31 +0100 (CET) Date: Mon, 14 Nov 2022 12:37:31 +0100 From: Peter Zijlstra To: Alexey Izbyshev Cc: linux-kernel@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Darren Hart , Davidlohr Bueso , =?iso-8859-1?Q?Andr=E9?= Almeida , Yi Wang , Yang Tao Subject: Re: [PATCH] futex: Resend potentially swallowed owner death notification Message-ID: References: <20221111215439.248185-1-izbyshev@ispras.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221111215439.248185-1-izbyshev@ispras.ru> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Nov 12, 2022 at 12:54:39AM +0300, Alexey Izbyshev wrote: > Commit ca16d5bee598 ("futex: Prevent robust futex exit race") addressed > two cases when tasks waiting on a robust non-PI futex remained blocked > despite the futex not being owned anymore: > > * if the owner died after writing zero to the futex word, but before > waking up a waiter > > * if a task waiting on the futex was woken up, but died before updating > the futex word (effectively swallowing the notification without acting > on it) > > In the second case, the task could be woken up either by the previous > owner (after the futex word was reset to zero) or by the kernel (after > the OWNER_DIED bit was set and the TID part of the futex word was reset > to zero) if the previous owner died without the resetting the futex. > Because the referenced commit wakes up a potential waiter only if the > whole futex word is zero, the latter subcase remained unaddressed. > > Fix this by looking only at the TID part of the futex when deciding > whether a wake up is needed. > > Fixes: ca16d5bee598 ("futex: Prevent robust futex exit race") > Signed-off-by: Alexey Izbyshev Acked-by: Peter Zijlstra (Intel)