Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp269264ybm; Thu, 28 May 2020 22:59:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxah//8ulFGv08gFFWboEdBuY8Q55++nuoJyUmtWZL0kLNYR8V23qLHlVF5okHB8/+mBt82 X-Received: by 2002:a50:fc83:: with SMTP id f3mr6849351edq.138.1590731993182; Thu, 28 May 2020 22:59:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590731993; cv=none; d=google.com; s=arc-20160816; b=DfxMofwBWeAZEn0axXK8y/EgO5rMJAI/EgOwZsStnn+/F/BniGbhxdB2VZSMJlesL+ 4NjZxM/PJXrT0CoJ7x5+ksEEbM6XxjEy8B/0pxTpdbszMrfAMRfsliePfPneXUt+krBI QSdVlhuXjz57gZIfkCZuFp+bgJlIo6b4LCBu7ynIbSkUBiXO4mfVlmh6oXzCBEDx3I6f 4PWpd6Fm7iEe1i5aTtzdlUdoDUw0Jil1uXc7DawHrHBbJZqTvWgUKTErpiYOfYJlpmmK Xdn0Rf27f1y03XvlwxbKlXfLvpNgXGahSR2ui0kWcM+k0Q74HTc633qS33pv94SG8war YprQ== 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; bh=yE2/iN3p029WGOMVloebt5hJ7wtaevOp6PpDRZFBkOg=; b=M4/hba7C+v+rm5JAUYuKWzwpz1LcaDOjh/5y33JNXFvRI44Xua2kUubf4cyGGnnxw6 UOkv3Ij2b4iXZRAAcULgnoTOfgJNUbkcIWFEduRWFwsFHPncZxep4ww67Id/wfuyCptJ +2UOoPmLiPbkX9fHKwXWXDAhJKtURALnzFGZD31HAztKd4Y/rXXdzgU/C9WKyheHOueX 6Gmf12JxLfbn4g7SJpzF/pL8lAcOK9TKYJIpm91h0D+8djUIuJdkpX3qjTzdaBIUk/as Km6aGpSMwMpZuoWw4xyy2KxqJispanPGKkS88MsajNttQY46ybfGVhS8eozOIPh5aRPZ N/nQ== 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 v12si2218705edy.431.2020.05.28.22.59.30; Thu, 28 May 2020 22:59:53 -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 S1726282AbgE2F5k (ORCPT + 99 others); Fri, 29 May 2020 01:57:40 -0400 Received: from verein.lst.de ([213.95.11.211]:59724 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725355AbgE2F5k (ORCPT ); Fri, 29 May 2020 01:57:40 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id EAA7E68AFE; Fri, 29 May 2020 07:57:36 +0200 (CEST) Date: Fri, 29 May 2020 07:57:36 +0200 From: Christoph Hellwig To: Al Viro Cc: Christoph Hellwig , Linus Torvalds , Ian Kent , David Howells , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-security-module@vger.kernel.org, netfilter-devel@vger.kernel.org Subject: Re: [PATCH 09/14] fs: don't change the address limit for ->write_iter in __kernel_write Message-ID: <20200529055736.GB6788@lst.de> References: <20200528054043.621510-1-hch@lst.de> <20200528054043.621510-10-hch@lst.de> <20200528190052.GM23230@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200528190052.GM23230@ZenIV.linux.org.uk> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 28, 2020 at 08:00:52PM +0100, Al Viro wrote: > On Thu, May 28, 2020 at 07:40:38AM +0200, Christoph Hellwig wrote: > > If we write to a file that implements ->write_iter there is no need > > to change the address limit if we send a kvec down. Implement that > > case, and prefer it over using plain ->write with a changed address > > limit if available. > > Umm... It needs a comment along the lines of "weird shits like > /dev/sg that currently check for uaccess_kernel() will just > have to make sure they never switch to ->write_iter()" sg and hid has the uaccess_kernel because it accesses userspace memory not in the range passed to it. Something using write_iter/read_iter should never access any memory outside the iter passed to. rdma has it because it uses write as a bidirectional interface, which obviously can't work at all with an iter. So I'm not sure what we should comment on, but if you have a desire and a proposal for a comment I'll happily add it.