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 264ADC433EF for ; Fri, 10 Sep 2021 03:15:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EECB8610C8 for ; Fri, 10 Sep 2021 03:15:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229929AbhIJDQr (ORCPT ); Thu, 9 Sep 2021 23:16:47 -0400 Received: from zeniv-ca.linux.org.uk ([142.44.231.140]:59120 "EHLO zeniv-ca.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229461AbhIJDQq (ORCPT ); Thu, 9 Sep 2021 23:16:46 -0400 Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mOX0p-002myG-1d; Fri, 10 Sep 2021 03:15:35 +0000 Date: Fri, 10 Sep 2021 03:15:35 +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> <88f83037-0842-faba-b68f-1d4574fb45cb@kernel.dk> <8d9e4f7c-bcf4-2751-9978-6283cabeda52@kernel.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8d9e4f7c-bcf4-2751-9978-6283cabeda52@kernel.dk> Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Thu, Sep 09, 2021 at 09:06:58PM -0600, Jens Axboe wrote: > On 9/9/21 8:48 PM, Al Viro wrote: > > On Thu, Sep 09, 2021 at 07:35:13PM -0600, Jens Axboe wrote: > > > >> Yep ok I follow you now. And yes, if we get a partial one but one that > >> has more consumed than what was returned, that would not work well. I'm > >> guessing that a) we've never seen that, or b) we always end up with > >> either correctly advanced OR fully advanced, and the fully advanced case > >> would then just return 0 next time and we'd just get a short IO back to > >> userspace. > >> > >> The safer way here would likely be to import the iovec again. We're > >> still in the context of the original submission, and the sqe hasn't been > >> consumed in the ring yet, so that can be done safely. > > > > ... until you end up with something assuming that you've got the same > > iovec from userland the second time around. > > > > IOW, generally it's a bad idea to do that kind of re-imports. > > That's really no different than having one thread do the issue, and > another modify the iovec while it happens. It's only an issue if you > don't validate it, just like you did the first time you imported. No > assumptions need to be made here. It's not "need to be made", it's "will be mistakenly made by somebody several years down the road"...