Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp2098094pxb; Sat, 7 Nov 2020 09:07:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJw3gSWoI2b+q5JlnzKCLE+0pLVZFdM6FS75n7T7NMHfOjeGUqhLquba+ZRDgTqvZg+l0seE X-Received: by 2002:a17:906:4bc2:: with SMTP id x2mr7798853ejv.525.1604768876241; Sat, 07 Nov 2020 09:07:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604768876; cv=none; d=google.com; s=arc-20160816; b=d6tQdVCN9ueUTtMg3yFgoxEVthxY/4alXpRWEmXclfiR0P6AphjOHGm0BHfdgzwObr I/67aRfzTr3GxIol6GbHtNYBXvS/noaJ8pyHIibnyvmclBLUWkrVqD5aV9r5bsRpGVMx /ukxHeUhkM6MkQnfzmr6dZsOHcruzYb/Yh1M2BlXzz1Pkg2VXUxe4HrmHvb72o6ieItt YRBE2VD/EPX0hyQVOKqrhRbRGIJ+kEullX+3drbL4fWfsyv55B0HgTPwf8dMRBgVvbDN zSh2n2P8pORGzGQJnKTQ/cl7fBG2btydYPOJ33Q3Zfsc8RV9kve68KCHZp1uI214xBiC VQSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=JlcoCq4LZsws4kAs2BL+JU418W1eKS1g0O4x6nc6vgQ=; b=IsFdvoNoVvNAWExDqsshK4+xIlhgQT6SvMm4ghtU7ULaXVoaavUloCzWhuYJJq5Rn2 VxWpm7UQggdqLpOn+Hgj9xcUzD+t+nT/Ja72+G3Jc9J23aDv7CqIWCSyFabzpeAlRXSJ meVxBflv6jCMrtkMOl4qHzvSDlIHc8RjbuHMQw43mVCssYArjmkkHRlGFMKa/oCgmmz9 RfOQGPdAdyfqawW5e8fuHlaLJ1t54vCzE3gBoJCHjuLcTUQehzia3JnqjfnH53sXy4uH xhOMmblAz6NYzb1cThp3FBuGWGV8vOuiFsKS4HDeEE08G1EK+c9Ej+sPs0qRCejhGMC+ xOTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=QlA7eViq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g12si3523781edn.285.2020.11.07.09.07.32; Sat, 07 Nov 2020 09:07:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=QlA7eViq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728073AbgKGRGI (ORCPT + 99 others); Sat, 7 Nov 2020 12:06:08 -0500 Received: from mout.gmx.net ([212.227.15.15]:50213 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726021AbgKGRGI (ORCPT ); Sat, 7 Nov 2020 12:06:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1604768751; bh=Gu0WHITa0criXSqANy2S1d1UtRU7iAxv438rr4aOewU=; h=X-UI-Sender-Class:Subject:From:To:Cc:Date:In-Reply-To:References; b=QlA7eViqDE4BJp/uod6GWfIibxEw0X/Af7089XXhdesg7jGPSv+HBEvcFNLzHwBPv 5w3feqSzysWuSq4rNX4InKiEcpXV0MGjn++U8O5YW/9AAwnoKnW3JqNvMjnypQwG+x xkHGUfZG1B8ZLjRLoU95zCZ7Gy+gVS7Nc/Xv/0I0= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from homer.fritz.box ([188.174.243.132]) by mail.gmx.com (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MfHEP-1k8QEf49RD-00grVP; Sat, 07 Nov 2020 18:05:51 +0100 Message-ID: Subject: Re: [tip: locking/urgent] futex: Handle transient "ownerless" rtmutex state correctly From: Mike Galbraith To: linux-kernel@vger.kernel.org, linux-tip-commits@vger.kernel.org Cc: Gratian Crisan , Thomas Gleixner , stable@vger.kernel.org, x86 Date: Sat, 07 Nov 2020 18:05:50 +0100 In-Reply-To: <160469801844.397.7418241151599681987.tip-bot2@tip-bot2> References: <87a6w6x7bb.fsf@ni.com> <160469801844.397.7418241151599681987.tip-bot2@tip-bot2> Content-Type: text/plain; charset="ISO-8859-15" User-Agent: Evolution 3.34.4 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:ZiuJpoFJYDSR3qK2/20rrBaJA+nWuFyZ+EthNZWpgv9Uw3F0lUt ai/drL6/+w8HYHW8pGHpcR9RfEVPIn7VWZuiNqplOsou85AQdwmP65ymQD706F0jbUPzr50 U9VW2InHnT80E8OdDSnluA+eQ++jg5ohyPBt8lGugZTl8auy7WelopmOyqGPjTryXdlccyq ghE2l9/0R5ZP3rcjuYDyA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:Kx50ttsafBs=:/6qke+AmwAAMFP7RyqRuTZ jubrDnTO3UXJYxzwEmX+vqlc5LQaiyRbPkAXdu46+rbUnPJ9ACpgBDoXocinlxyMmMK9IBlF+ hrjpcyxz0XGA4qKu7t/fxnaE75tvNLY0dxMSGbAmAOwPcCtvBNKaGnrriQZxZ6wqO036DsLSu cUYABAV9hZSMsxnSPtRLEfK9ViMJeVz9GclQGF4TapNxaPT2aEfdHVsb7EqQ7mWyWX7KOKmgG FLXPoh2mZliusRg/fG1UOPSei7owE6ZmBZHiFg6K7EgYKvLZVC4ncWGiyPadusgCMv7CVjXEi bkSz/3kBE0d/v9uWPDV1vN/wH8CuDopb9yd62IIMoB+MC88e6phlKH6v+da0mkokVK8SPhvnu Z+BkmTIkGiWx5ckZmVIuSUzUoNDbkf8O0+FAcUn/eEJI1pNTXsNagz6Ma8C/BAWFRJ4DoC8yL HZLMrm6+U+tcAH5Q4lB0sEPhJNO/5tDaJk5Z+98nxVUxBssQfjkc8UJEEaQwxCOIp6s7ElqCx cY34TJS5yzuIDwew/l649PI2R5pvOYPerHN6idoaD60R3oujCbTCAROP41uT2m7YqvbpAyKco 3WOeQRdxLJiiF+ln/WtzQ51JLDLvyZPhaD2gJMp3PaWdXvJ6V9fQEwl+IOc/2YwbX3AGfLlDg odJuNe5sVaoVy90E4djg90lJTjmwO1+5UiR32RscbXmAUUDzWHMTU7UadxmsMBxggRJ/UHFgi X2/izC2UmBzYUx8OoUZXhbOofrwgaW7E72uIyqqBthqZE3Bc2T1PMvplielFGfFkc077fYXX5 ulmIiB0Lx8VwVAbjEwFCViFt+/LZoB8tv+AQThP48QWrTwMkzY20u3Boa/4nG+IfyDg4ZxWQn cDqKJ3RaaCSfTZT6HbYQ== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2020-11-06 at 21:26 +0000, tip-bot2 for Mike Galbraith wrote: > > --- > kernel/futex.c | 16 ++++++++++++++-- > 1 file changed, 14 insertions(+), 2 deletions(-) > > diff --git a/kernel/futex.c b/kernel/futex.c > index f8614ef..7406914 100644 > --- a/kernel/futex.c > +++ b/kernel/futex.c > @@ -2380,10 +2380,22 @@ retry: > } > > /* > - * Since we just failed the trylock; there must be an owner. > + * The trylock just failed, so either there is an owner or > + * there is a higher priority waiter than this one. > */ > newowner =3D rt_mutex_owner(&pi_state->pi_mutex); > - BUG_ON(!newowner); > + /* > + * If the higher priority waiter has not yet taken over the > + * rtmutex then newowner is NULL. We can't return here with > + * that state because it's inconsistent vs. the user space > + * state. So drop the locks and try again. It's a valid > + * situation and not any different from the other retry > + * conditions. > + */ > + if (unlikely(!newowner)) { > + ret =3D -EAGAIN; ^^^ My box just discovered an unnoticed typo. That 'ret' should read 'err' so we goto retry, else fbomb_v2 proggy will trigger gripeage. [ 44.089233] fuse: init (API version 7.32) [ 78.485163] ------------[ cut here ]------------ [ 78.485171] WARNING: CPU: 1 PID: 4557 at kernel/futex.c:2482 fixup_pi_s= tate_owner.isra.17+0x125/0x350 [ 78.485171] ------------[ cut here ]------------ [ 78.485174] WARNING: CPU: 2 PID: 4559 at kernel/futex.c:1486 do_futex+0= x920/0xaf0 -Mike