Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3988896pxb; Tue, 26 Jan 2021 09:30:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJxnv4OQBk31vOSyH02c7EFx/IsebKSi2ZaVgZRzr7nM+amfohWYGJ50ylFz2iEDJlw/OWjV X-Received: by 2002:a05:6402:4389:: with SMTP id o9mr5512710edc.164.1611682208633; Tue, 26 Jan 2021 09:30:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611682208; cv=none; d=google.com; s=arc-20160816; b=g3mcvPv4ZfHfO7F1W9exVa7x2bZLQDMgAWKGvAB7YqNt83Iv7jiyYcmDfFsDWtg4mZ y2zETF8AtmRGXsvaYgx5VZuIFaS/xQiq51Ynfoi3KRYmtYKuwgrHqFlr52K0FAGv8tD6 FmdSyAjWe3mjwStS1g3haR6NJl4t+swZlsk7uDOvzTO06cnLZSV7w46PFz5bG1cYm2u2 xibUstUp1HXB1qrRVlDDjmBE6cLtRov6qo3YlQwBae2bcWeEFxGri6He3/8UV0actFVD LXd6bz24YvaMmYQ3ziv/t2FtgJDsjCP71L3MnICl49eDt910qhv/KiTZLi/Lo1vJ60uC CDMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=F6N/WqSQjbykgSG+aZ8tr/HT+cHB0EAKbMBQZtFaWCE=; b=KUXDQGoc8cmJDjyT/zNOJqlmDZIl9hPadXCCXZ2C+GLYR1t3oS4+hlCuZO7cJY5pkr ZHszQhGuzz/p/HfJQHcZL2p9jnbwzInmWkKaMq86oS5UAG/hGSOaLJkxFlcK0snng31v ZANSqL+T8VouZTT67BU+vgH7KlGjjgZMLFvItiJHFfBsiWPEPXSyoZVWCrDJKEBMXBKs MRsmwZq3Kql92D5COaCfhfxI41njzFKJvrwynPNc+xCxpKoc/xebSNqZPdkeLLVjIsN1 l7h2MgeG2Rar/0QJIpUCJdTrRYfZYL9rd81r04j/s6GSYhuqSwmu/UWQvene9LlSgYml ZaoA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ko3si3920372ejc.321.2021.01.26.09.29.42; Tue, 26 Jan 2021 09:30:08 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728688AbhAZEwd (ORCPT + 99 others); Mon, 25 Jan 2021 23:52:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726210AbhAYJRU (ORCPT ); Mon, 25 Jan 2021 04:17:20 -0500 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB595C06178A for ; Mon, 25 Jan 2021 01:16:30 -0800 (PST) Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94) (envelope-from ) id 1l3xyv-00BMTE-H6; Mon, 25 Jan 2021 10:16:21 +0100 From: Johannes Berg To: Linus Torvalds Cc: Al Viro , Christoph Hellwig , Oliver Giles , Linux Kernel Mailing List , Greg Kroah-Hartman Subject: [PATCH] fs/pipe: allow sendfile() to pipe again Date: Mon, 25 Jan 2021 10:16:15 +0100 Message-Id: <20210125101615.efceefcaeae0.Ibe2d56dfaa49d7a366c835b5ae0f0a5c2d643ede@changeid> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org After commit 36e2c7421f02 ("fs: don't allow splice read/write without explicit ops") sendfile() could no longer send data from a real file to a pipe, breaking for example certain cgit setups (e.g. when running behind fcgiwrap), because in this case cgit will try to do exactly this: sendfile() to a pipe. Fix this by using iter_file_splice_write for the splice_write method of pipes, as suggested by Christoph. Cc: stable@vger.kernel.org Fixes: 36e2c7421f02 ("fs: don't allow splice read/write without explicit ops") Suggested-by: Christoph Hellwig Tested-by: Johannes Berg Signed-off-by: Johannes Berg --- Mostly for the record, since it looks like we'll have a proper fix without another intermediate pipe. However, this fixes the regression for now. --- fs/pipe.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/pipe.c b/fs/pipe.c index c5989cfd564d..39c96845a72f 100644 --- a/fs/pipe.c +++ b/fs/pipe.c @@ -1206,6 +1206,7 @@ const struct file_operations pipefifo_fops = { .unlocked_ioctl = pipe_ioctl, .release = pipe_release, .fasync = pipe_fasync, + .splice_write = iter_file_splice_write, }; /* -- 2.26.2