Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp1420747ybg; Wed, 29 Jul 2020 13:52:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXO+bONBh/jkrKxBf9ov6WOiOs+gJ+UjjNpj3s1nkWoJs/I4HFJQxv4+WPqe87L35lWxoI X-Received: by 2002:a17:906:2a41:: with SMTP id k1mr196055eje.300.1596055921222; Wed, 29 Jul 2020 13:52:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596055921; cv=none; d=google.com; s=arc-20160816; b=W1W7OmhoEjO2ayD45+01hmjHBo40rQ9gLMyciabxOZw8lkQQ/oj+qzdFyebx9rJN6g OjroG3P43uSuYi0gGlJo5lxtAEdTBOJPQCaLb3/BH/iGqBP4iRDG4/CKWiNv4Rvo09bu GSYeGcfjBTnIPa7+UGXOuuakC0A9nkvgdkdAPK+ttenfY3XPhUz+IxneoKA3NBtZRECJ 7PuvVvEnqhfoEzivXeA4ITv03nCAe8M+M7wIcKY6GYnQTynfJM8ITkX6h4/uA4LOw0us 1fdoYHRBrlZ+Cbaz/2jL1Ij7mbVu2MPv7c5U3FqBfQKCVrNXM2nZiRXYo3Ey+c8H3eNi n0kQ== 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=y6QjDXaCj8dTya55BKsXwXTo/x9MJoev+N7TkQgFlDc=; b=Qr5xpyXex9MA8QK0sDSVOmHc+y7m3bSnaUQcGe4SNzIAtYP0d3pZVWKhyq+EwFzJo3 XCl+vB8WkyCOgh8yoowkGplHATonurtfGo/4PpXzomRHdQHjC1bQMYT9RiWkrRiPOlMc ygBQn2Egy2wzys42mmNvBd3MbXHg0O6mrFhk+2+3iXqQLxxTX+M7Gn5V/5JxpAxTOqLS cQG+02xB156QyYc8LGxNStu6tB7Xv3nPNPPbx32xUnlTdVj5gXol2/YIwdaq8CTrx2IL kkP9qLuL1MWc80RnCRzuq8V28kmOBViCoXvr5FoGvjwrmPa1iouGs9Je/ABm7NYm6iqp RIgQ== 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 bl24si1690376ejb.602.2020.07.29.13.51.38; Wed, 29 Jul 2020 13:52:01 -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 S1726821AbgG2Uuu (ORCPT + 99 others); Wed, 29 Jul 2020 16:50:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726476AbgG2Uuu (ORCPT ); Wed, 29 Jul 2020 16:50:50 -0400 Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [IPv6:2002:c35c:fd02::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EB0DC061794; Wed, 29 Jul 2020 13:50:50 -0700 (PDT) Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1k0t24-005CZh-9W; Wed, 29 Jul 2020 20:50:36 +0000 Date: Wed, 29 Jul 2020 21:50:36 +0100 From: Al Viro To: Christoph Hellwig Cc: Linus Torvalds , Stephen Rothwell , Luis Chamberlain , Matthew Wilcox , Kees Cook , Iurii Zaikin , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH 08/23] fs: don't change the address limit for ->write_iter in __kernel_write Message-ID: <20200729205036.GA1236929@ZenIV.linux.org.uk> References: <20200707174801.4162712-1-hch@lst.de> <20200707174801.4162712-9-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200707174801.4162712-9-hch@lst.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 07, 2020 at 07:47:46PM +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. You are flipping the priorities of ->write and ->write_iter for kernel_write(). Now, there are 4 instances of file_operations where we have both. null_fops and zero_fops are fine either way - ->write() and ->write_iter() do the same thing there (and arguably removing ->write might be the right thing; the only reason I hesistate is that writing to /dev/null *is* critical for many things, including the proper mail delivery ;-) However, the other two (infinibarf and pcm) are different; there we really have different semantics. I don't believe anything writes into either under KERNEL_DS, but having kernel_write() and vfs_write() with subtly different semantics is asking for trouble down the road. How about we remove ->write in null_fops/zero_fops and fail loudly if *both* ->write() and ->write_iter() are present (in kernel_write(), that is)? There's a similar situation on the read side - there we have /dev/null with both ->read() and ->read_iter() (and there "remove ->read" is obviously the right thing to do) *and* we have pcm crap, with different semantics for ->read() and ->read_iter().