From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3F60C433EF for ; Fri, 10 Sep 2021 03:36:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7901461074 for ; Fri, 10 Sep 2021 03:36:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230127AbhIJDhY (ORCPT ); Thu, 9 Sep 2021 23:37:24 -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.