From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7986C433DB for ; Fri, 8 Jan 2021 22:47:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0E81723A80 for ; Fri, 8 Jan 2021 22:47:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0E81723A80 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 69BB08D01B9; Fri, 8 Jan 2021 17:47:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 64C9A8D01B7; Fri, 8 Jan 2021 17:47:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 514408D01B9; Fri, 8 Jan 2021 17:47:38 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0169.hostedemail.com [216.40.44.169]) by kanga.kvack.org (Postfix) with ESMTP id 37E078D01B7 for ; Fri, 8 Jan 2021 17:47:38 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id E9C43180AD801 for ; Fri, 8 Jan 2021 22:47:37 +0000 (UTC) X-FDA: 77684096154.20.roof42_3112069274f6 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin20.hostedemail.com (Postfix) with ESMTP id C9452180C07A3 for ; Fri, 8 Jan 2021 22:47:37 +0000 (UTC) X-HE-Tag: roof42_3112069274f6 X-Filterd-Recvd-Size: 2958 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by imf32.hostedemail.com (Postfix) with ESMTP for ; Fri, 8 Jan 2021 22:47:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; 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=y6utkV8+rnLd3kCaXRS1gntJ/Qt+RxB06NgyDB05tsQ=; b=cWZ2NApOkgotnnOjxHpSpSy41f QBDtpEdN6cXwaoS+nil5TbeOvdq7tGHv0fAA5n+xeWL4divsAEgYZuT9I3hjz7AsLMYZKv2VuwTdu EdtYBgK0jHYipoTeq3UvKbLlStfuTVu+b4OgnnmDI2ika+Ee7+a2dZg6Gfij4xdofckqeD5EOxjOb 93vnwdD/6UnmcHpBPnSKgDcX3f9vpqqtDT4/iE5sBWH+Jkyney2V7HACZeK7VWa4A5BqdoYMnXsGN eWto8aD02c5iegGv1szt7ghMaD7SmGYctTFWTc3u83YnlcU2xu/EoFN1rjM85EUrEVohihkEfjMk0 mpzXX7kw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1ky0XR-0003Uq-KF; Fri, 08 Jan 2021 22:47:21 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id 05F819866B1; Fri, 8 Jan 2021 23:47:15 +0100 (CET) Date: Fri, 8 Jan 2021 23:47:15 +0100 From: Peter Zijlstra To: Tony Luck Cc: Borislav Petkov , x86@kernel.org, Andrew Morton , Darren Hart , Andy Lutomirski , linux-kernel@vger.kernel.org, linux-edac@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 2/2] futex, x86/mce: Avoid double machine checks Message-ID: <20210108224715.GB2453@worktop.programming.kicks-ass.net> References: <20210108222251.14391-1-tony.luck@intel.com> <20210108222251.14391-3-tony.luck@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210108222251.14391-3-tony.luck@intel.com> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Jan 08, 2021 at 02:22:51PM -0800, Tony Luck wrote: > futex_wait_setup() first tries to read the user value with page faults > disabled (because it holds a lock, and so cannot sleep). If that read > fails it drops the lock and tries again. > > But there are now two reasons why the user space read can fail. Either: > 1) legacy case of a page fault, in which case it is reasonable to retry > 2) machine check on the user address, bad idea to re-read > > Add some infrastructure to differentiate these cases. > --- a/kernel/futex.c > +++ b/kernel/futex.c > @@ -2658,6 +2658,9 @@ static int futex_wait_setup(u32 __user *uaddr, u32 val, unsigned int flags, > if (ret) { > queue_unlock(*hb); > > + if (arch_memory_failure(uaddr)) > + return ret; > + > ret = get_user(uval, uaddr); > if (ret) > return ret; I think this is horrid; why can't we have it return something different then -EFAULT instead?