Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp415935pxj; Fri, 7 May 2021 11:23:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwS5deyPh/2zl0AnBFF1Qa8NPFtjpYvY8K0gqf6IUtrxlrHdOqlY10hdN7mbJZNbUxWuW73 X-Received: by 2002:a17:902:7444:b029:ed:5334:40b6 with SMTP id e4-20020a1709027444b02900ed533440b6mr10922302plt.35.1620411836888; Fri, 07 May 2021 11:23:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620411836; cv=none; d=google.com; s=arc-20160816; b=AgvgAlXPRiJFsPo94ZvBTnirTW9jRD8lNlnMN4c6uploFAeOe4+WZPJSNoCRpxnUBm fYMY29KUdL1mdo76W2InBh53o+Tl1894TyJg5R7hICIoE9SIbVfoRKVK5+2Apv1ip61t pG2fOCqjBJXX3CR4F3QPdu8nmumu6NRbx1LSSyDeizPuudiVJP2jVCj4EaZFyRtABHkC mmRIhbu1wcWN9HTQSTLVTLoaJMQT9fUJCddu/udVJIvqPcAvldMRaBHD/Zbl+OnLiNrF 1VXS7sg1UTAqI4GnBUlYnNsJv8EI3VtJvHbhQvyMU8dLPk3Ta4N+X8dW3M4UjYyzBlcx EWtg== 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=7fCSrm1y7Xq97IAHremOIKdD7kw68d58fJ8MoM3puqQ=; b=FAtS2Y/q0ZOLB/R56Ed576RKwIFfKwkZfUqRcSLtwWW1zbZuPONY4IdcRQbeBQw0K8 KzTU4hTJQnv6OtYZB44cnxpwTizdUS+0W432NRhR1sJ653YVmG9+HoUWF1V45YI9mH2k wFBVdPVS02McutEwzy6MWAKbowHCKJ43/2LF3U/HzqeZloi5Z4g/8l4u6GPgj2JhtUbG Cco9/Vr1oJtBuiEdJ0u3Cvx94pYH7/jm1JMlLCNo5xN2+ixYEPzQTp+1Xg4HwBeumyL4 sE4AOv2se7OKgwE4JqzSv567ry9Iu5O2UqBtAyKnzjpJKsHEAQ/vapPak53T17thb8aN nf2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=j3BSf8Nu; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t12si1336629plg.423.2021.05.07.11.23.44; Fri, 07 May 2021 11:23:56 -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; dkim=pass header.i=@chromium.org header.s=google header.b=j3BSf8Nu; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229656AbhEGSW4 (ORCPT + 99 others); Fri, 7 May 2021 14:22:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229476AbhEGSWx (ORCPT ); Fri, 7 May 2021 14:22:53 -0400 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 953FCC061574 for ; Fri, 7 May 2021 11:21:53 -0700 (PDT) Received: by mail-pg1-x535.google.com with SMTP id d29so7754554pgd.4 for ; Fri, 07 May 2021 11:21:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=7fCSrm1y7Xq97IAHremOIKdD7kw68d58fJ8MoM3puqQ=; b=j3BSf8NuC3uBjJ1o6h9PeYHzU0Ac0zV2hjFUujVGeXxs7IdzCgRj3eZMnuviX4e6SH pKsTMZGFJTIleEe5s/wqWDiikh6hYIYLO6w2BzH4AOj8QiXmGyvojQzI9egq9xfviAr6 i9+E82IavVQ0v3J5OH+S8IsmL5bCgsRjIRoos= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=7fCSrm1y7Xq97IAHremOIKdD7kw68d58fJ8MoM3puqQ=; b=PDzQgyCsSwWMmnckuT7uGmoQARVrHxbzaOsxHWKrYf2tbcoTeVEoRV/eQFGAWlhgym 1CxbC363LOPlKmbsUVVs/5VDAfuKjwHtZSbQa8Fo4Ja9tNMfO9Y51FmaRhKyJR2HEJhI Bdnc3xG2O4UPCGpXESjHAs3bWvX9vip0Xfh0mqqNym+wX9w0BSOp9i6rBVuM5GgZQT8a 2P33g/cXBONIirdVPpsNKRIjXnkTMnBEcMp3XB4Jhx63DlfbKpnOH41w7lIqj/HDFcK9 e4KhE3MkApBZAoyuZyBCjiys5ebAn5azpCa4FLQUei2mdVkquT/m1JBAE3AeOJ2STgiW WmgA== X-Gm-Message-State: AOAM532Sf+WViQSDYtUZuVyEPB4BiOZHhFkT6jCsZowmBthn6DvYIJ62 BAxe0Xdxab/2baD/yAjlmoFFKg== X-Received: by 2002:a63:f258:: with SMTP id d24mr11148640pgk.174.1620411713164; Fri, 07 May 2021 11:21:53 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id x22sm3863506pfp.138.2021.05.07.11.21.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 May 2021 11:21:52 -0700 (PDT) Date: Fri, 7 May 2021 11:21:51 -0700 From: Kees Cook To: Colin Ian King Cc: Christoph Hellwig , Al Viro , Linus Torvalds , Johannes Berg , linux-fsdevel , LKML Subject: Re: splice() from /dev/zero to a pipe does not work (5.9+) Message-ID: <202105071116.638258236E@keescook> References: <2add1129-d42e-176d-353d-3aca21280ead@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2add1129-d42e-176d-353d-3aca21280ead@canonical.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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() So the question is likely, "do we want this for /dev/zero?" -- Kees Cook