Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp184919iog; Sun, 12 Jun 2022 23:36:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxijQeV5KHsNygGqNvTTAt6shxErac2YuNaMvvnNXpgNNTDZjeHYVHM5yf0sXuJWd+1Id2b X-Received: by 2002:a17:902:cf0f:b0:15a:24e0:d9b0 with SMTP id i15-20020a170902cf0f00b0015a24e0d9b0mr56146630plg.42.1655102182440; Sun, 12 Jun 2022 23:36:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655102182; cv=none; d=google.com; s=arc-20160816; b=ov432W4xnQlXzNjCOgGolLtwU4GmL18Cg4fNJZxhTuaOggfDthXeaalCr0xHa0iy76 C8eZeu9MvG8yfevC4udemilvPZtWiLkDChkhoAGW6RHHAiLkh80BUDWOEeEcKu4oHy7z Q5QAet+lROIqR2bEE1ZMcljtsLAmcwMNIujD9NuEaBb7w2ksVWOU9r0oFDLuFE5a8Bso UdWvt+IW/UrUDohuJLfkyFj/oImdCspUjRDRHW4Jj6e1aVLnaiYWzJgiHqrrkCZSMEfg p8PiEvlj6nwqZtEOHUAW/oc/OGzlLBhZF6VesUMCa3P2Yep2qAleU+4eQNhdoap1P4Ud mrww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=wmuWffwYI5wQkMEQNcTP/vfzVD9gd23o8xCkm8CaTjg=; b=TCbzI/lllQZglXvpm+J9JLv/IFU0cbB/rvLRUFrLAoD6QNs9J+GjKG4EOBPWag/tS1 DO4/jEQVLiwatdM4Pt+bUOfGioOVIxhy8KtKjSR7LClikSFsIZWbcsvnjei/ihe1rBPl SrAx57njmBpjg70LmhzjosFVopiajChhleuah4uRJhYOepnuZh+WPGG88jCrpLceK9wQ n1QtX6rkDcTyIXA+kgZKTg1p1ctm/sBv+VDFis8Pg6VAl/rZdjFZvQOrU9ozXFJ92ulY dTZ7lrj1g/jA2AAvYFpaat1zIBabi5ja2vBTe+4xpxG+zURpIPCSt6ADBcsuH2cs6ob0 GKfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fastly.com header.s=google header.b=Fp5rK1Mf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fastly.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a190-20020a6390c7000000b003fae4107372si7981047pge.533.2022.06.12.23.36.08; Sun, 12 Jun 2022 23:36:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@fastly.com header.s=google header.b=Fp5rK1Mf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fastly.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234048AbiFMGcr (ORCPT + 99 others); Mon, 13 Jun 2022 02:32:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233081AbiFMGcp (ORCPT ); Mon, 13 Jun 2022 02:32:45 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84F78DAC for ; Sun, 12 Jun 2022 23:32:42 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id m39-20020a05600c3b2700b0039c511ebbacso3983286wms.3 for ; Sun, 12 Jun 2022 23:32:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastly.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=wmuWffwYI5wQkMEQNcTP/vfzVD9gd23o8xCkm8CaTjg=; b=Fp5rK1MfFr7t7OWhGPFj6PXfZ+1zTyGLy1BZhb0jhOjOPTihMoY3qlO6w6ojQuKSbX u06H+hw0P8U2HYiDN3hkg8H/96iWaNEmnvU6udFIcNRtaKc9D1sVLnomQiUY8PcQTdoI E3hH8Sc0yqhqPxVv5Lm/X2wt2dM6a40fgT1dQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=wmuWffwYI5wQkMEQNcTP/vfzVD9gd23o8xCkm8CaTjg=; b=fnOKZXaizd+PRZFQyNccjn5cXo6ff3OIXNXmubYOs5zIajvu06YgcA8wv9BTwF0Utw 3haiGa4VJnKg+3cHDw4qgh2Tvaw0RPtx+Jgygxd8gUVJVqrbU8D5c0NwiKfQXQOQotK5 S+Jkt6Gzb/Cx3kO4h3J1H2AzK889JZ3bhtVvulBRknWmvKj1G7Tr9MLlS9b5i4G3VKZc svhePCNyPwt6MrhzMWiruzlr3vGjNPalJVlN5rTJrjRaQJmIFYVBLCFEYINtcQjwHC97 ieZ+8obhJqz9BqLOcyQGTfSBovlvp4gBxapGeSpr5bKxnyRfAa5JzyU8PLCICHiAzOHE SCAg== X-Gm-Message-State: AOAM531Wi8ldKbt1x7IMag6zA/gUEheuyzQeqGw2/OLlAI4fJCZ38d15 NC7ETig3rZjOuonAlFq4patP2aX+aMsPkA== X-Received: by 2002:a05:600c:4010:b0:39c:481c:c5bd with SMTP id i16-20020a05600c401000b0039c481cc5bdmr12834033wmm.139.1655101961108; Sun, 12 Jun 2022 23:32:41 -0700 (PDT) Received: from fastly.com ([178.130.153.185]) by smtp.gmail.com with ESMTPSA id r8-20020a05600c424800b0039740903c39sm8038933wmm.7.2022.06.12.23.32.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Jun 2022 23:32:40 -0700 (PDT) Date: Sun, 12 Jun 2022 23:32:38 -0700 From: Joe Damato To: Al Viro Cc: linux-kernel@vger.kernel.org Subject: Re: [RFC,iov_iter v2 3/8] iov_iter: add copyin_iovec helper Message-ID: <20220613063237.GA24325@fastly.com> References: <1655024280-23827-1-git-send-email-jdamato@fastly.com> <1655024280-23827-4-git-send-email-jdamato@fastly.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 13, 2022 at 04:25:39AM +0000, Al Viro wrote: > On Sun, Jun 12, 2022 at 01:57:52AM -0700, Joe Damato wrote: > > copyin_iovec is a helper which wraps copyin and selects the right copy > > method based on the iter_copy_type. > > > > Signed-off-by: Joe Damato > > --- > > lib/iov_iter.c | 19 ++++++++++++++----- > > 1 file changed, 14 insertions(+), 5 deletions(-) > > > > diff --git a/lib/iov_iter.c b/lib/iov_iter.c > > index d32d7e5..6720cb2 100644 > > --- a/lib/iov_iter.c > > +++ b/lib/iov_iter.c > > @@ -168,6 +168,15 @@ static int copyin(void *to, const void __user *from, size_t n) > > return n; > > } > > > > +static int copyin_iovec(void *to, const void __user *from, size_t n, > > + struct iov_iter *i) > > +{ > > + if (unlikely(iov_iter_copy_is_nt(i))) > > + return __copy_from_user_nocache(to, from, n); > > + else > > + return copyin(to, from, n); > > +} > > Just a sanity check - your testing is *not* with KASAN/KCSAN, right? Yes, that is correct. > And BTW, why is that only on the userland side? If you are doing > that at all, it would make sense to cover the memcpy() side as > well... I assume here you mean the memcpy() in the splice() path? I do have a separate change I've been testing which does this, but I thought that can be sent separately. This RFC basically takes an existing kernel feature (tx-nocache-copy) and makes it applicable to more protocols and more fine grained so that it does not need to be enabled interface-wide. The memcpy() change you mention is, in my mind, a separate change which adds a new feature and can be sent if this change is accepted upstream. Let me know if that makes sense and if there are any issues you think I should address before I send a v1 for consideration. Thanks for taking a look!