Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1097366pxb; Thu, 9 Sep 2021 20:40:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOjqyFExufdLQ2mJO44CfoDEy5kBe6dWpXotwebaAXhJdmIacDe2zZyB12xBDm0K2X+H8J X-Received: by 2002:aa7:d645:: with SMTP id v5mr6712944edr.145.1631245201109; Thu, 09 Sep 2021 20:40:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631245201; cv=none; d=google.com; s=arc-20160816; b=nRYYuRL1luCcmyxKWgU93EZI/yPTnAKVG15VTJw9mM4qg3nMJgjtnq6/iSxU5Alqv8 BmzXYaZT/G+WAadKjA6QjdXmnGunJoggrltP7ApFMtDVE14d8qga3bfzF2lxkr+Rugcd rWUKVA90pPx7roEt4Y9zwSEHpZFEo5+fVo+xaueYT76PihrD3Gm6YEBw9a8zbbDre1u4 J+STzZlqI7UqinBlQUXQqPncLP6yWVVHq+WoKlig3NvhH/hWg9Gq/005CzFxPwqyBcTV LJszcOyd1Zzt7NtitwQXjsX4HXLxaWpck7V/SUeZfaD9DMCADrL9pokl6yyg6KcF2Myr Tddw== 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=xZY4aqbq/EykxiE7emcdBQtXdEuxcwBU4FRu2YIJhHI=; b=hiAKFRJntWkTbJDvl8+jwz7AYHwHPYGOgHn+T91AXnys91qTPsUFwsMSXx2hSRdavW SGet7nG3gdw8bU3SfY4FH4VOL13qT/9oDpZiLm+2bESkKkXS/4YeXOGmCpEqKlDUO3KC wcRskShIie0czbDtEJSEwhCym2D9gNzMZ4Bzk+ls/P5uVq9sziJ3RsDbMdY8gmCph64y v0qiISiZtJr/rRDJZjtBvLBR9jt8lqRnNsm+gDh6qFJJuf+fjdAm1kDmR8NjX1D1BqOi VV9eEL9fesRDNNOp/6qlujmcZ/0erEky7EvPqeH+EQF90ECVQiygaKtNuBZAgsqr27+Y 3bUA== 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 s6si28765edh.408.2021.09.09.20.39.37; Thu, 09 Sep 2021 20:40: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 S230060AbhIJDhX (ORCPT + 99 others); Thu, 9 Sep 2021 23:37:23 -0400 Received: from zeniv-ca.linux.org.uk ([142.44.231.140]:59454 "EHLO zeniv-ca.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229929AbhIJDhW (ORCPT ); Thu, 9 Sep 2021 23:37:22 -0400 Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mOXKk-002nGL-82; Fri, 10 Sep 2021 03:36:10 +0000 Date: Fri, 10 Sep 2021 03:36:10 +0000 From: Al Viro To: Jens Axboe Cc: Linus Torvalds , Pavel Begunkov , Linux Kernel Mailing List , linux-fsdevel Subject: Re: [git pull] iov_iter fixes Message-ID: References: <5971af96-78b7-8304-3e25-00dc2da3c538@kernel.dk> <9ae5f07f-f4c5-69eb-bcb1-8bcbc15cbd09@kernel.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 09, 2021 at 09:30:03PM -0600, Jens Axboe wrote: > > Again, we should never, ever modify the iovec (or bvec, etc.) array in > > ->read_iter()/->write_iter()/->sendmsg()/etc. instances. If you see > > such behaviour anywhere, report it immediately. Any such is a blatant > > bug. > > Yes that was wrong, the iovec is obviously const. But that really > doesn't change the original point, which was that copying the iov_iter > itself unconditionally would be miserable. Might very well be true, but... won't your patch hit the reimport on every short read? And the cost of uaccess in there is *much* higher than copying of 48 bytes into local variable... Or am I misreading your patch? Note that short reads on reaching EOF are obviously normal - it's not a rare case at all.