Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4464085pxf; Tue, 16 Mar 2021 14:19:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwkt6hOwXPHpUdjRy5Gc9BJjSIechUVMjpYx/roC/xhB0/mjJYeN7lvKJ+wSHqNpUZnMW1p X-Received: by 2002:a17:906:7f01:: with SMTP id d1mr11232265ejr.136.1615929548671; Tue, 16 Mar 2021 14:19:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615929548; cv=none; d=google.com; s=arc-20160816; b=qJCG42HdGi6+dRTQqwOpcVyK880D9u1debVlYJD55RF+1HP3QLRTWCp+HyIcdQmcZo Sedk9w1ou/IGch3wQaI7xh8LtFNDegC6CY+i2/JRqlVsmapsKKDp11DAnjf4/7bYvwpS aC9LXV3l0C+wPMMX0rMZ6Kxhl7mrL2a9MjTlIFzEYPizdjmzCQmv3dZCSJ9d9xHHmi0P i2hK2OZO4P/Isl/3sfPTb7JbBZb5Rj5j/uAU2CnJDyI+feXMlLYCMhfsLubbjzsXlvYq ryNQB7em7t9PWQzacUxNNlGV1dF69RLHswIXVR39vjWOKiDIjIqYghZ6tMeIuOqdozNR E8Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=lR4hUWGvoRy5ck1rpENqbvhxRoC9Mfj+U7rcwUYzPAY=; b=RRF/LGfAJj9gWdL0lgVOZe4nPBVc2f2flSM3Zj5uWOI1K/PC+e7qLvnoq3XijmKglQ pBv+XYc+VEsGwIYFNnG1g3xnVTzR1HHzaFPWatghEybKRVrCMbCevqkHwuDY9NEw3LZC KoPQwQzyNEuvNmCxqHL7DeBj3qb3PhQPhKc7/trHiiKgzJx4Z8Ydt0ORYgIhM/UvMI5R FPuFfkfGQLKRHcxLznDX8wwGX2cwWFnOZnRX+yItGJjb8UHQMBfhG+cuwGWDpU8H43c3 HV3RGEoIga6/JXvTK61UvQqyC+DSj9E5jv5sGMV3r5yd4xvYyKHEgwdf1t4HfuzO3PZa Pjqg== ARC-Authentication-Results: i=1; mx.google.com; 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 i25si14505752ejv.640.2021.03.16.14.18.46; Tue, 16 Mar 2021 14:19:08 -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; 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 S235287AbhCPSEV (ORCPT + 99 others); Tue, 16 Mar 2021 14:04:21 -0400 Received: from mx2.suse.de ([195.135.220.15]:48720 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239862AbhCPSDP (ORCPT ); Tue, 16 Mar 2021 14:03:15 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id AEBC2AE8F; Tue, 16 Mar 2021 18:03:13 +0000 (UTC) Date: Tue, 16 Mar 2021 11:03:05 -0700 From: Davidlohr Bueso To: Peter Zijlstra Cc: tglx@linutronix.de, 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 Message-ID: <20210316180305.sh7nyi4xjskd3e3j@offworld> References: <20210315050224.107056-1-dave@stgolabs.net> <20210315050224.107056-3-dave@stgolabs.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20201120 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Thanks, Davidlohr