Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4576469pxj; Wed, 12 May 2021 08:31:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrEEDpKOW/ZgrWjQxV9Hc/R8cMBXxmVgkOjqeM243cQMijJ8GmrQZtGBALEeQud8FsauXT X-Received: by 2002:a17:906:7c02:: with SMTP id t2mr3218993ejo.0.1620833497586; Wed, 12 May 2021 08:31:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620833497; cv=none; d=google.com; s=arc-20160816; b=V1JxCm1abN2oCbhgd9h7s8+pOBUiVlE38pHzzpP9BLUuS/ExDXOB1lorNn+THVJcTv WpTgIbMGPKDXgKIGyU3m42Yu+sL8t/Gr+0xp1reXm3o5+xKXuBsZkZPOzdPv9GMztRU4 VKT2biyLa7kqyyIxr62jm5zRjjSb53ZMzR10BdDeIXLKoZsZPead6ypFvJHfJi/hIARS NqBrU/Oz9RB04Uvydlw3arOdma4OMxqnVhO/ppndZaS7G5W+qR9yJ2v6zV6gQSuAl9+B +EMspSTUDj0muX9pk+QU9k7DwJ+3XeK/wgswLMdyJMtcQ5qObtlJ0iaDgn+Ox3up5JHg 908A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=FmQwR/N8r0KA6KXfvYiADLdKW8qsKD3Y2Abp71eNEQg=; b=GnCVHs2hlySZZepNUOshrkmyMMcbqerf0iYjpn9eay5+iFsimKG+xueW2Jh952Q4T0 JCqlqEAAd4yAkfiSf+3+iAoVmGwImSDhhHS6fKL2ZAH4FCWi2l2pfdj50XvS5wuLcPi9 YTaEztr5wFDbDqSnb/FhqMrd1670hoKYCWHq8QyTeG53zl4KCuZXTXjWLuJCQyjotAS2 IYIczwOSd9W8Cmmcm8k5WIf3v9e/KAlZoB96JlnpMb7hhXarNF8nyGSVVeZPv11MMZqJ H0E99+GI6lLTYsSb4QTll90B+Xhuh9hTEmlsFCxLOtsxpG3/AXjOTY5+QnXEnl71peVq GmfQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lk14si269688ejb.197.2021.05.12.08.31.13; Wed, 12 May 2021 08:31:37 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235795AbhELPaI (ORCPT + 99 others); Wed, 12 May 2021 11:30:08 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:32853 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233767AbhELPOv (ORCPT ); Wed, 12 May 2021 11:14:51 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212]) by youngberry.canonical.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1lgqYO-0007lr-Rg; Wed, 12 May 2021 15:13:40 +0000 Subject: Re: splice() from /dev/zero to a pipe does not work (5.9+) To: Kees Cook Cc: Christoph Hellwig , Al Viro , Linus Torvalds , Johannes Berg , linux-fsdevel , LKML References: <2add1129-d42e-176d-353d-3aca21280ead@canonical.com> <202105071116.638258236E@keescook> From: Colin Ian King Message-ID: <61a548af-840a-1418-4cb6-644db6c9ba26@canonical.com> Date: Wed, 12 May 2021 16:13:40 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <202105071116.638258236E@keescook> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/05/2021 19:21, Kees Cook wrote: > On Fri, May 07, 2021 at 07:05:51PM +0100, Colin Ian King wrote: >> Hi, >> >> While doing some micro benchmarking with stress-ng I discovered that >> since linux 5.9 the splicing from /dev/zero to a pipe now fails with >> -EINVAL. >> >> I bisected this down to the following commit: >> >> 36e2c7421f02a22f71c9283e55fdb672a9eb58e7 is the first bad commit >> commit 36e2c7421f02a22f71c9283e55fdb672a9eb58e7 >> Author: Christoph Hellwig >> Date: Thu Sep 3 16:22:34 2020 +0200 >> >> fs: don't allow splice read/write without explicit ops >> >> I'm not sure if this has been reported before, or if it's intentional >> behavior or not. As it stands, it's a regression in the stress-ng splice >> test case. > > The general loss of generic splice read/write is known. Here's some > early conversations I was involved in: > > https://lore.kernel.org/lkml/20200818200725.GA1081@lst.de/ > https://lore.kernel.org/lkml/202009181443.C2179FB@keescook/ > https://lore.kernel.org/lkml/20201005204517.2652730-1-keescook@chromium.org/ > > And it's been getting re-implemented in individual places: > > $ git log --oneline --no-merges --grep 36e2c742 > 42984af09afc jffs2: Hook up splice_write callback > a35d8f016e0b nilfs2: make splice write available again > f8ad8187c3b5 fs/pipe: allow sendfile() to pipe again > f2d6c2708bd8 kernfs: wire up ->splice_read and ->splice_write > 9bb48c82aced tty: implement write_iter > dd78b0c483e3 tty: implement read_iter > 14e3e989f6a5 proc mountinfo: make splice available again > c1048828c3db orangefs: add splice file operations > 960f4f8a4e60 fs: 9p: add generic splice_write file operation > cf03f316ad20 fs: 9p: add generic splice_read file operations > 06a17bbe1d47 afs: Fix copy_file_range() Ah..so this explains why copy_file_range() also returns -EINVAL now on some file systems, such a minix since that uses splicing too via do_splice_direct(). :-/ > > So the question is likely, "do we want this for /dev/zero?" >