Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1721951ybb; Sun, 29 Mar 2020 11:43:42 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsAowS9zDzuAibVguJw18Z2RXl5suuUjl+DAdq4ECm3XjkKA4Rm+2KHmfhtZnYITsT2AHZ/ X-Received: by 2002:a9d:5c0c:: with SMTP id o12mr6561946otk.145.1585507422085; Sun, 29 Mar 2020 11:43:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585507422; cv=none; d=google.com; s=arc-20160816; b=W1mY/F6uwsBi0/cFDzP1C3BsECw3X0vEbY6o0slWoFTwJuD7ZIvICa9sRUdR11tbw4 mgkeFUqzOvRvH3o1xxywoGJ+AnszLBp1fSY9t+jmv3uX5hNBGhbxUL3JmByFzx4iA50N 5fXUzTf9QgGuuX2h2m4H/gekI9mRmT8bSHKxdnOQZNAL+cBTvBmX59eebe0qKHz11Atb PHcTh5hJljM6nZVrcjwUTdLmQrvGiIyOLot+XAph8GpjRLQTHWYb1AfHJvyJk+X37Ii0 7j96feHjBsGkkouwWofe0IDMkQNCPRxfJO5Xowsb4XFeKNQ3T9B277bDB72ncx/xwGNG a94Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=JUwj4smZxsOP0/t2iUUmikGPboNus8bXUyXAQA7jHj0=; b=xpnV42paFzSOR/J2R678Olpb6B4zW6fQtlfH/FZNHJqino3EkHNlM0mNlW75xMUIKl HCCQ/Fi9JuRZGzzOYq/djE1vUXRDdPZvlZ8f2/M4zZD5sllHetXQbKfZNSHi7NMkdE0G 7yUI+oa5+uoCLFiFufnsAqr4IDHst07chhFuQaQfJ3G37wzxN1oZSEGoJW7XE77OEpw2 Gbpcy0ygwJuJobwpY0OWdAeZUUXuK/jzktc5sbUqV+EID6eyjncUTMWkDyzTXkyYvh8H U41CT7hgK1t/8O5Bs6p+LiiEdNYSKyV1aUZb4m+azZMvL2u+hkWxnaLT7ZZyKFjzmyvX rQsw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z23si5181336oos.54.2020.03.29.11.43.28; Sun, 29 Mar 2020 11:43:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728503AbgC2SSn (ORCPT + 99 others); Sun, 29 Mar 2020 14:18:43 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:36708 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727506AbgC2SSn (ORCPT ); Sun, 29 Mar 2020 14:18:43 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jIcTz-005by5-Ay; Sun, 29 Mar 2020 18:16:27 +0000 Date: Sun, 29 Mar 2020 19:16:27 +0100 From: Al Viro To: Linus Torvalds Cc: David Laight , Andy Lutomirski , Ingo Molnar , Thomas Gleixner , X86 ML , LKML , Borislav Petkov Subject: Re: [RFC][PATCH 01/22] x86 user stack frame reads: switch to explicit __get_user() Message-ID: <20200329181627.GD23230@ZenIV.linux.org.uk> References: <20200323183620.GD23230@ZenIV.linux.org.uk> <20200323183819.250124-1-viro@ZenIV.linux.org.uk> <20200328104857.GA93574@gmail.com> <20200328115936.GA23230@ZenIV.linux.org.uk> <20200329092602.GB93574@gmail.com> <489c9af889954649b3453e350bab6464@AcuMS.aculab.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Mar 29, 2020 at 10:56:59AM -0700, Linus Torvalds wrote: > But, if you have lots of performance-critical get_user() calls, just use > > if (user_access_begin(..)) > goto efault; > > .. multiple "unsafe_get_user(x,ptr,efault);" .. > > user_access_end(); > ... > > efault: > user_access_end(); > return -EFAULT; > > and be done with it. Except that you'd better make that if (!user_access_begin(...)) return -EFAULT;