Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4466561pxf; Tue, 16 Mar 2021 14:23:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzsFdnY+ymsIsdm2jOmyMxw0mS1edHOpxFBM2DS3jSTVDj8GRR1klQ/+s+4m2aGClKtWM7c X-Received: by 2002:aa7:d54c:: with SMTP id u12mr39785590edr.234.1615929837663; Tue, 16 Mar 2021 14:23:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615929837; cv=none; d=google.com; s=arc-20160816; b=w3ReBxNzC/mCz4krWjY0dXr9NEA5t3DcoMFSaHhRN0uNDdebEGfbE/jkg8J2Rv21gJ NtYEE4rcUrLCriZuJx+elU9dfgcJjxhZjOWN/Q1nV84am8JU2ItmkzBRh5pWIBOC6Nnb tdcVG+9faPwd5XGJ5bGrcz20XsiZcJtCS21rJOv3gluzYvjfe+dQI0e+d17x9ib4MsY1 9rGCGEGZP2jlCr2npr6GwoxzyGDTEuOJQv3CeLExhXiuqV4CTa5GJXOYndowB60xQDcS oMh6dd2F/yGX9TdxB0X2usQhqlhrRcCeq9x+TKBTnRw3CgbJaFSAk9stQ4N4+FQO6IZV gdgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=uRw7n8NDH/xKVa1BdRtlfYFO/sQ1st+ZQbLu0oouf90=; b=Y/odokesoM4HkX/yOqvVWtd3IOJkLtQOHWIhoIC+B2vrlYJO2ujoVI2Etqi6PbHX4k gEDWbcxbK1+pv7aXzVh2WXf6D+Li6zozDTSPZz8TkGpWQfYgfeAIjRmN5ABiQW4piWyD nsZNvW7uHCK10AIW/pgTZj94KXfpapv53R5Wer1cA8uZbUeXF0yjWAIx3Hi+J2FBbO58 EeL2TTsB7Q50DjJufvCRHItXeMzAcrSXPQ1Ivumd+awvTZCKw/s5XTv4FmM9a+rSKBEG PnuOQdPNHk2Qg/oiHQ2GZJjmhinXbAT9VPEtgfVcUL3rjD5siGTXFpQWyVcHNhd6puL7 wxrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=hLtkfOQg; dkim=neutral (no key) header.i=@linutronix.de; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y2si14896464eje.495.2021.03.16.14.23.34; Tue, 16 Mar 2021 14:23:57 -0700 (PDT) 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=@linutronix.de header.s=2020 header.b=hLtkfOQg; dkim=neutral (no key) header.i=@linutronix.de; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236913AbhCPTtN (ORCPT + 99 others); Tue, 16 Mar 2021 15:49:13 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:44074 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231738AbhCPTs6 (ORCPT ); Tue, 16 Mar 2021 15:48:58 -0400 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1615924135; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=uRw7n8NDH/xKVa1BdRtlfYFO/sQ1st+ZQbLu0oouf90=; b=hLtkfOQgvO5903XhIqu2IqWGMNbdFqsSIq0fxxpZvoz5Ke5VpTaF1h6jTSSIRWgaQtO19H nV+1NJGkwP7GWWX0QK6DZM8IUSldMVpCtGYhQzg71tG5+msPFjQFNKJn+K79YRH90gY6mk pm4GcOlG1p8CcUxQRmuXOA1wEscE5BDLr100ZHAxqzfY9WotFRPsTymAkXcfYyrTMieh6z hZL6cJ5gw9sPp0Hk2GZu+AKmo8JmWidw9B2aUuCC52KCPIY2aO/swJgj+no2mirzh3VKsu RzTQYH5SGS2dFBTeH0U1Z+HaIwuM+42w7DSVZdrxKxApwZrtCqqiJO++JDTE6w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1615924135; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=uRw7n8NDH/xKVa1BdRtlfYFO/sQ1st+ZQbLu0oouf90=; b=EZrXTc4LywkCfTMOamwTdFSfC7eJ2r5vL4Rywzzh0exnDiAUCmQI2fxKKew+8JapjTcrvN KeS+PHzXYx0iNKAg== To: Davidlohr Bueso , Peter Zijlstra Cc: mingo@redhat.com, dvhart@infradead.org, linux-kernel@vger.kernel.org, Davidlohr Bueso Subject: Re: [PATCH 2/2] futex: Leave the pi lock stealer in a consistent state upon successful fault In-Reply-To: <20210316180305.sh7nyi4xjskd3e3j@offworld> References: <20210315050224.107056-1-dave@stgolabs.net> <20210315050224.107056-3-dave@stgolabs.net> <20210316180305.sh7nyi4xjskd3e3j@offworld> Date: Tue, 16 Mar 2021 20:48:54 +0100 Message-ID: <87im5qzxp5.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 16 2021 at 11:03, Davidlohr Bueso wrote: > On Tue, 16 Mar 2021, Peter Zijlstra wrote: >>IIRC we made the explicit choice to never loop here. That saves having >>to worry about getting stuck in in-kernel loops. >> >>Userspace triggering the case where the futex goes corrupt is UB, after >>that we have no obligation for anything to still work. It's on them, >>they get to deal with the bits remaining. > > I was kind of expecting this answer, honestly. After all, we are warned > about violations to the 10th: > > * [10] There is no transient state which leaves owner and user space > * TID out of sync. Except one error case where the kernel is denied > * write access to the user address, see fixup_pi_state_owner(). > > (btw, should we actually WARN_ON_ONCE this case such that the user is > well aware things are screwed up?) > > However, as 34b1a1ce145 describes, it was cared enough about users to > protect them against spurious runaway tasks. And this is why I decided > to even send the patch; it fixes, without sacrificing performance or > additional complexity, a potentially user visible issue which could be > due to programming error. And unlike 34b1a1ce145, where a stealer that > cannot fault ends up dropping the lock, here the stealer can actually > amend things and not break semantics because of another task's stupidity. > But yeah, this could also be considered in the category of inept attempts > to fix a rotten situation. It's one of the 'Doctor it hurts when I shoot myself in the foot' cases :)