From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: ACJfBov0dx78WS168Y3fy482qQNJMn39TNZra08wf/+kxDR91SvVjFaxVHTFPARnpZJ9V+U8GAu6 ARC-Seal: i=1; a=rsa-sha256; t=1516293501; cv=none; d=google.com; s=arc-20160816; b=0vQuflYzhQwDbeFDNyLQVyqN5G52REXCLSc727cf85hfsyzJyOoSK0ZlOmnYTguvgf yQuCUAwF7bwC7mKZTBoK2nvuDjc8WLmbhc+jZUxbOdtlb0UcEY+Fq6uHzl1LP1jZpcPz /K6k4PGvtWZROOq4yBWawSXAgZtXRVb3bw3WiBN/ZSsDrICQ+3SuDNe677eB4UB3m02E Qvsyu5zYD6D49fcIzwUH6mrBubCUdKBmxc/g9fKZqWQ9ilZh1QDLwjprl9hDfURApCL1 FhBXhJVpMCk8thlYBDDTskkaZQu+2IVDX0oQZXfXF2AF9KIrn3yuHEnZ+HcKl21NDWoh 0M0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=piiV7PzIUAe1SqBv2MMiPoP6FGQ8t1BqQW9TvU9BFc6a/kTo4ITbXPZ5KL0WC22ynD AuT7vHlfWuFayGCjoGrpKnjVFJSd3nOmqpc+gHVBNDckWLLlXAQFquMZwqWbShR4NTSh rvVDho/RnRvW03N06LVcPYMMWy6hTr8htj3YpZQHsS4aIaKV/5W8LraAXAxxa/+N/EFU Cw825JihMVSxDey47GbPFC4Ys4z/rVIRHsnMwukhBAbYG0LSz4nMo83gMUVnLKmzV10Q /VGg5C81Ad3tPFy6jmTjfqO+hrMgA/18Mda+CNaKAs7yxTDkdNoLsRNAr7PryoOwpEOz xokQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=A4OQRAnZ; spf=pass (google.com: best guess record for domain of batv+8aa4359751633f819e66+5261+infradead.org+hch@bombadil.srs.infradead.org designates 65.50.211.133 as permitted sender) smtp.mailfrom=BATV+8aa4359751633f819e66+5261+infradead.org+hch@bombadil.srs.infradead.org Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=A4OQRAnZ; spf=pass (google.com: best guess record for domain of batv+8aa4359751633f819e66+5261+infradead.org+hch@bombadil.srs.infradead.org designates 65.50.211.133 as permitted sender) smtp.mailfrom=BATV+8aa4359751633f819e66+5261+infradead.org+hch@bombadil.srs.infradead.org 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: =?utf-8?q?1589502788463144818?= X-GMAIL-MSGID: =?utf-8?q?1589948974127551813?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 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.