Received: by 10.223.148.5 with SMTP id 5csp7715390wrq; Thu, 18 Jan 2018 08:39:35 -0800 (PST) X-Google-Smtp-Source: ACJfBossMJEpfOupwSLZtwr75gq0qh8Xf+ax7c7lbzyPTkopXaIDBstDZRXqNR++LOdOhNScrv3M X-Received: by 10.101.96.198 with SMTP id r6mr15132217pgv.420.1516293575703; Thu, 18 Jan 2018 08:39:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516293575; cv=none; d=google.com; s=arc-20160816; b=TIeQeqmM41chkS26Lsj96EaS01uuTE4hS09OZyWu/Pet/2Sr+PJ1fNE67uPoGaT+/7 2jXHOrhtovuFHknqCD+plYWLwwjCKNOI3oPvABtUEYSV9amIjW4H+8RTQKsBT/Q/QdDl NOWkrAFGekcnSUWygHToReKGa/z5rhkZ2kis7NFgWs+1AHgS7n2W+grk2rGHWD6m3Ncv 6soHYe9wr56wO3CvYiEO6DJGMlnno1184CbpGynn43sJ14CArEb5YvC0OnTIJv4gdw8G hIXsr6RRHQb1f5DeIBg09RrbnsLeJwo77E5TGw4Z8r4OGMr0ZGm7i0llwCMGoukadxsF h6nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=OMyWqP0Y1cpjDYaG7oVDqqu4xqUimiWbLu7cCx+hzOQ=; b=mSe6RtPZc+4qpGMoir92nMRq1pq2fWiON9TXSonOnSy44e8pFegqDWcK4JAYEqx9Mj o3wF0cGhgoJzQIucrytIyCG1cHppggxXoIKPnBAF6r3diMkOF6KlC3SjO5XkRu0h7UBk 80VjqDa7oWcCXXU6O2b6V/dug5GCcEvW18w6NoHZtsgTXHsl7aFVRbPY4TNK+vjUy7Si f2olT8i9DlpusNGTxMFPTWnch2o9BTewZ30ZMvvADfIDXjTbDFrukfs7c3t4WdPiW8Rd //LQTgtezK+7Z39UZUGnARH/JZ0RQc62put6Ul9utIjSfAiDgJkdQAYDStvOhCDhUeR0 0Npg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=A4OQRAnZ; 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 k11si6577393pgr.73.2018.01.18.08.39.20; Thu, 18 Jan 2018 08:39:35 -0800 (PST) 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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=A4OQRAnZ; 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 S1755416AbeARQiW (ORCPT + 99 others); Thu, 18 Jan 2018 11:38:22 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:55727 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754513AbeARQiV (ORCPT ); Thu, 18 Jan 2018 11:38:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=OMyWqP0Y1cpjDYaG7oVDqqu4xqUimiWbLu7cCx+hzOQ=; b=A4OQRAnZ873BFX/P0hUDsPpDs yx+2wEyPIRew2UxfAuo0wjUeLzEO2wsyVyKDT0NXZIJFFox4rkCHLCMwGeisHFT696TFC7AN5WMRZ WTFDIBzon7s9heopD10WMvhFzKj4wbQP60vifqNhFziW2HysFVYBMseG1U6ATC3fEoi79q9Wp2oe7 W3CV3csPlWRt7N262urt675tRwyiLPDba/px7Ofe3mokG4aCLi49wB2D29jXklE/4d4AfEeXuqI/6 8n+EaiJQv5WO25NWw0VVtCZcsihrH3Mnf0mXGHEhc9IR7h4vAzhdKtUaUV09sbUo/Q+3CMgKWTfy5 6je1UuetA==; Received: from hch by bombadil.infradead.org with local (Exim 4.89 #1 (Red Hat Linux)) id 1ecDCk-0001fK-QA; Thu, 18 Jan 2018 16:38:18 +0000 Date: Thu, 18 Jan 2018 08:38:18 -0800 From: Christoph Hellwig To: Linus Torvalds Cc: Alan Cox , Eric Dumazet , Dan Williams , Linux Kernel Mailing List , linux-arch@vger.kernel.org, Andi Kleen , Kees Cook , kernel-hardening@lists.openwall.com, Greg Kroah-Hartman , the arch/x86 maintainers , Ingo Molnar , Al Viro , "H. Peter Anvin" , Thomas Gleixner , Andrew Morton Subject: Re: [PATCH v3 8/9] x86: use __uaccess_begin_nospec and ASM_IFENCE in get_user paths Message-ID: <20180118163818.GB16649@infradead.org> References: <151586744180.5820.13215059696964205856.stgit@dwillia2-desk3.amr.corp.intel.com> <151586748981.5820.14559543798744763404.stgit@dwillia2-desk3.amr.corp.intel.com> <1516198646.4184.13.camel@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.1 (2017-09-22) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 17, 2018 at 11:26:08AM -0800, Linus Torvalds wrote: > But there are about ~100 set_fs() calls in generic code, and some of > those really are pretty fundamental. Doing things like "kernel_read()" > without set_fs() is basically impossible. Not if we move to iov_iter or iov_iter-like behavior for all reads and writes. There is an issue with how vectored writes are handles in plain read/write vs read_iter/write_iter inherited from readv/writev, but that's nothing a flag, or a second set of methods with the same signature. But there are more annoying things, most notable in-kernel ioctls calls. We have quite a few of them, and while many are just utterly stupid and can be replaced with direct function calls or new methods (I've done quite a few conversions of those) some might be left. Something like iov_iter might be the answer again. Then we have things like probe_kernel_read/probe_kernel_write which abuse the exception handling in get/put user. But with a little arch helper we don't strictly need get_fs/set_fs for that.