Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1086478pxb; Thu, 9 Sep 2021 20:16:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOgZqSKmAEgWDTdZW3/XhBtydW2qv3SKtkp6kNVhG2vUPYQ5P+myxdDNHsRmm2mSm2iLKM X-Received: by 2002:a05:6638:4122:: with SMTP id ay34mr2691938jab.131.1631243788780; Thu, 09 Sep 2021 20:16:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631243788; cv=none; d=google.com; s=arc-20160816; b=O2AXM5k71+8UiR/lbCF3f2J77J9v3CpIadvzO8GoXHcPSLdFKwjYyid8JWifCGqtEc odx5OzAME8l3HllQqPtZ7OdHXwvpyXN2SG4Ed8AeVPGjLj8qBCaC8XVCjlflino27/Rg IcpK37aUDzg5+DwqRMuYB5W+E6kxF86oxqawFe/RxGJO3qMBTgIOYJ6LrDIf3vaHc7nb rIpUdJ4UpSAcjGRu/01uOQdtFSXvGNuF9paonOD1ALObuPbh1tPPIPm6rWFNBn8ibAAV DUyGv9ctuuE0m3Zh+5Xa9CWuR9Wv2m1HCf5lhuAFEUHA7TfghMXXLW85R4SuvIws38Kt OZOQ== 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=Oc3gtMStFkhmMJIPiMlxTfwt2yH4St3Pl1UUDPj8L6k=; b=WAJCMypVN8tjXoF6uhf4cXMktDZlNKbWboP7B6cUPDc2KdoIoRmZe9dXfiGEPpWdPT BJ+EKUi7GICz0f16FIXreHIOLo3Po55i60Vza3bWTPhuAWhnjAauBJlWKPXEp1NkqC26 pnMqL4GaZ3wOmrASonW2CpMwYKF1O0rcNIQrbtsdj4GtzrhuDS0vM2WfAEk1fZ/WJg3F F2KaDKeCDA4csUb4EpSZLRaLByQl8Yo60gBZsYaHcbKbL+sJTH+jXDdyvATCiydtblze wSSeEifgg/UsIhWrxhA/bfwjLchE8zqduO2mGxQ2OC5/eh+mHBfXXW5Mok01I8xFqKpf OP9w== 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 h13si3742005ilc.131.2021.09.09.20.16.16; Thu, 09 Sep 2021 20:16:28 -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 S229944AbhIJDQr (ORCPT + 99 others); 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-kernel@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"...