Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1652776ioo; Sun, 22 May 2022 23:06:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxl3a+nME1UcpOGbhN31qv+bWRa0SlqFLEleYFc9JUPkvWqval6cgCO53+jjE3YG5ozNZtb X-Received: by 2002:a17:90a:e7c5:b0:1df:d622:dd06 with SMTP id kb5-20020a17090ae7c500b001dfd622dd06mr23422511pjb.127.1653285978167; Sun, 22 May 2022 23:06:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653285978; cv=none; d=google.com; s=arc-20160816; b=DCAwpJPRB/kSI1H5MWhVqBHlFsEAk6jrUHuLqRyIWaN7HksH0MyGfcFlbzg35Xz58m sCiKGLsMZYP8v9mlHo9XovOXD/HLkyN2LoESye//toudEvsLVKgvCXQdr+D5loNWDV5/ lm/yOXJz+sc5IXYpSI6B8tctzN/HyrnsHHRO5nr0mxG7VcxGSYFKomsONZdjtFJKPIDf EUbPRUfDG3qLqViOV6ReAyagY09CmmFy0rPeNlpT4ZzHx6icyLdnMDj+ylOG2ST5uVXh G79lcalSL2L6+PLt/ikCPS+g5Emq+rU26t4VXlWCXlc+aDtUyuadSfh/XKd2PMqbObRL BVWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=HkpLX5d+0MkqzwvQ+3AzHLCEwixfF+WafpJiNTDl1Es=; b=wupMGcbMmwNcsUnxPvIopp4jMcEDsUPfA9zN1ZqwCQlUsoSaGE5hbqn67Zu/IxB2yq LYqBpsdSkAksTlpAZEou8U3+yjwvVApCCL4+Pns8ErV7j523vA0rMK7c5Vj8YJBUvNMI zS00s+0mLUAdtVpDw0HV3oBQawcSjTwhiUk02rMuc0of/80CNbuIzN/L7FCMiuwwUN3R dxnh/mwYrg7tgrkd5R7WsPR37/4ZtHAyxcH8w1fLqoFf2XAbM8xoe68/ZYOUxNabXD8F LlAulPHg/UIG5ZR2nMhhM2UvHy8z5XTSlSKbg1cRggMCrJG7rlc1VRoCi8YEqHoV/cFr 3RRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20210112.gappssmtp.com header.s=20210112 header.b=CFUdPM7h; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id k14-20020a170902d58e00b00161571fd712si8181837plh.450.2022.05.22.23.06.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 May 2022 23:06:18 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20210112.gappssmtp.com header.s=20210112 header.b=CFUdPM7h; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6954F2CCB0; Sun, 22 May 2022 22:57:54 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245702AbiESXTg (ORCPT + 99 others); Thu, 19 May 2022 19:19:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234213AbiESXTe (ORCPT ); Thu, 19 May 2022 19:19:34 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D77C3F74A7 for ; Thu, 19 May 2022 16:19:33 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id o13-20020a17090a9f8d00b001df3fc52ea7so10000022pjp.3 for ; Thu, 19 May 2022 16:19:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20210112.gappssmtp.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=HkpLX5d+0MkqzwvQ+3AzHLCEwixfF+WafpJiNTDl1Es=; b=CFUdPM7hPWEqCmvntb3hYKm7lunX0hbEt78+UwJQUB3/uulVfQ3Jkhlbx2FjPY1sjS 8GBVHdJrYhD+u2PSOY+WnKMBKW5X/djPknhbdSXfcgNbJn1udy7GKyJ/dEg+uyHqS2gA t+HFd+SUX45W7uMf0YnyR+u8mLbhbqWu8W3PpWf/dpiDDItFPh4ehpmDKc/U7MJiflu5 x1QscZl0If66fGcoTLjTN3fAu56rICItFmb1fwU2mKZwmS59cKb6SLEa8j0cXNU2SWKc ZuBXAA2KlnPQQ6387jFGK5E4hLUswusf2vAKHmgrecl+oUidaSWkjD0a/fatJAn56ZYW A5rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=HkpLX5d+0MkqzwvQ+3AzHLCEwixfF+WafpJiNTDl1Es=; b=Mq5QXaRnx2paop8ME381mcXMycKoaa4b87Qa/icfD+QrWqo14LY6vborn+92z+M3yV C7kRblj4WB8UocN+TGfh/fPqMoURAfYIL3sD6sudAbdWpEIJP/IgtVi1oBxec7WDOWud rI9WKjQY2JI3SI/x/MccrCNHZ/BMi4krDlTOU0/NhULYhb7DhIfsmCr8+86AcUvWtJl/ XOJBOZEUZxpHwoqZR9ZCjp/aY8mP1C5vSq0OA6NLeKPwEXQnu6Ch/m7muVTZDI7jKXBx +oU/PVarw+WfC8SVxmoD/8fVoMjNZXiQ1nBf7Ot/BSb8MFVl0IaygZIv8GciwL3yxSEX 1NNA== X-Gm-Message-State: AOAM532Amhjblg7rPxr2V3iOqlNZNXJZlNmhbYvNh9lWFxt1lvsoXf2D d0ECvaOuWvbmzm5XM2YQZzgA4A== X-Received: by 2002:a17:902:d4c4:b0:161:bfc2:8e83 with SMTP id o4-20020a170902d4c400b00161bfc28e83mr6921147plg.57.1653002373237; Thu, 19 May 2022 16:19:33 -0700 (PDT) Received: from [192.168.1.100] ([198.8.77.157]) by smtp.gmail.com with ESMTPSA id a5-20020a62d405000000b0050dc7628163sm232437pfh.61.2022.05.19.16.19.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 19 May 2022 16:19:32 -0700 (PDT) Message-ID: <3553b935-0aca-3d3e-2495-12288f601b53@kernel.dk> Date: Thu, 19 May 2022 17:19:31 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCHSET 0/2] Fix splice from random/urandom Content-Language: en-US To: "Jason A. Donenfeld" Cc: tytso@mit.edu, hch@lst.de, linux-kernel@vger.kernel.org References: <20220519193133.194138-1-axboe@kernel.dk> From: Jens Axboe In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 5/19/22 5:13 PM, Jason A. Donenfeld wrote: > 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? The source and destination for the copies are exactly the same with the change as before, so no changes there. The non-user copy is a different helper. -- Jens Axboe