Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp230158ioo; Fri, 20 May 2022 19:55:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHjeIpJu/n12U75udOoSMNr6PZ1/LmsXdNe7CM+aH7FAvr5V3dkq0PrufbSpUTM2BcGRYW X-Received: by 2002:a05:6a00:14cf:b0:510:5549:ad8a with SMTP id w15-20020a056a0014cf00b005105549ad8amr12767909pfu.24.1653101725639; Fri, 20 May 2022 19:55:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653101725; cv=none; d=google.com; s=arc-20160816; b=dveiuUkCpc6HdzzKGZNtjYwOuHjSdlJlYCptOur6+GHLjG0ht77LHBYdxcHb/5OmRA UM/D6dCSJE2u7sRNoIcievs6B1MRtZd7MuYk7XvFYnVO4VP6zE/ucbUc3N7CxnghVjer E58DJrhyBOJSDZT7HuTk6noMai/7UtOMC5h7VYFOHo+b3rrh2NmXd0y9DvlI+dq+qVwD I+ZV4KiX4yx5AYVUAp7TgjFVXioYfIF5bSGpTHjoF8xxcxKqANvcL4KKs5Fx9leFjWOm sK9f7p+sP8L1BC/NwjwILQ0YlXWzogvamz7qhOUBtoT6CcYlJY/YrzRqY5rTILesDuGd NE7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Vg8EgL5l07IptbmY+1AkGLthZNVnNbClGhjWdqOGk8Q=; b=d1dKTkByHyxCoHT3vDyjFL9ZyHao30cbEyvfMMRkmKPfjs4e3Sv9V44krqUu9GYrAv pALSeHSEMiH8NDIjIiw5cLSTI6Krx3I7mWA79p4i0yEYC0Ti3UTVzgw3wtScPwq4YaWf tLby6vRKAkEOmgTMbWOoOd/QaNv9fzf2N6YlVWmv5dLEThT0ndOxcwNJIWML8sW8bA3Y OAoj7jbKYOKk2mhZH1gBhqLxr8BQtzaMF3BUzs+pKL4yb1bp1tYjvMncN0JnsVwI7O3d jIcIwGFP4W1xLRZ7qV/xyqwDQtDAMsRIKlyyS0ZzKSUc4ctqiMoGCWinpiC5sKIwdfjs OytQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=oL5ntF+E; 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=NONE sp=NONE dis=NONE) header.from=zx2c4.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n2-20020a17090a9f0200b001df0b9b6d05si4662093pjp.186.2022.05.20.19.55.12; Fri, 20 May 2022 19:55:25 -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=@zx2c4.com header.s=20210105 header.b=oL5ntF+E; 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=NONE sp=NONE dis=NONE) header.from=zx2c4.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245259AbiESXNV (ORCPT + 99 others); Thu, 19 May 2022 19:13:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245759AbiESXNR (ORCPT ); Thu, 19 May 2022 19:13:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DF5810654B for ; Thu, 19 May 2022 16:13:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C0F4C6187A for ; Thu, 19 May 2022 23:13:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB1F3C385AA; Thu, 19 May 2022 23:13:14 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="oL5ntF+E" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1653001993; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Vg8EgL5l07IptbmY+1AkGLthZNVnNbClGhjWdqOGk8Q=; b=oL5ntF+Efrsww7IVuS+h8SINkOnKYtJ2/IUciuolk53yFFiEp1vs3RMzfODL4RQGRjS4RU 4FDBdmNuEYHcldwadDvpO75rotxUS9S7fFjf2JRHA6wElcf6tCAEuwpdzahvGnAndKlspV 9Gs5IxLJxt9TWYMdv8njFkWHpv34I6k= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id d6184367 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Thu, 19 May 2022 23:13:13 +0000 (UTC) Date: Fri, 20 May 2022 01:13:11 +0200 From: "Jason A. Donenfeld" To: Jens Axboe Cc: tytso@mit.edu, hch@lst.de, linux-kernel@vger.kernel.org Subject: Re: [PATCHSET 0/2] Fix splice from random/urandom Message-ID: References: <20220519193133.194138-1-axboe@kernel.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS,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 Hi Jens, On Thu, May 19, 2022 at 02:49:13PM -0600, Jens Axboe wrote: > > There's a lot of attention in random.c devoted to not leaving any output > > around on the stack or in stray buffers. The explicit use of > > copy_to_user() makes it clear that the output isn't being copied > > anywhere other than what's the user's responsibility to cleanup. I'm > > wondering if the switch to copy_to_iter() introduces any buffering or > > gotchas that you might be aware of. > > No, it's just a wrapper around copying to the user memory pointed to by > the iov_iter. No extra buffering or anything like that. So I think it > should be fine in that respect, and it actually cleans up the code a bit > imho since the copy_to_iter() since the return value of "bytes copied" > is easier to work with than the "bytes not copied". Alright, that's good to hear. So even for kernel->kernel writes, the argument is that what ever buffers are used in the process are the same ones that the user would be hitting anyway by calling write() on the destination if this roundtripped through userspace, so nothing changes? Jason