Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2386406pxb; Mon, 18 Jan 2021 17:05:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJzAX9LBkB/eIbv0PrK2iaYttIo3Lfkl5OxA6EP4DM/BNfDf0VvPJ3rQ47tKThtq/Vvmcp+p X-Received: by 2002:a17:906:68d0:: with SMTP id y16mr1520293ejr.128.1611018330054; Mon, 18 Jan 2021 17:05:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611018330; cv=none; d=google.com; s=arc-20160816; b=KQKucPFM+vHZNcgfm2aaUO0fjU1ReTrYq1uVE/4lFkPmAl6o+FmPGyJT7lOER4X2Rq +82SMcLfUdCZNrbkuQ+mPS/lhSODhkCTpzx0RGcNEyj7kq/OpoMI2l8VdRKYjXOc5KMz rIWkNfFw8r3qofS6vUjqAXXKR4CKqs3sxWr7ghsRYiqiWyt0NVhwEwMdHj6xYJbz/F4h ncBTXvBu1J3yjnYqheKSq4J8j6NGSYuAL6wThGWyNPxI8XSDPB3SXoZjdlF2qervmLH4 yevy5WDS05cUiIlAZ+HK266o29lT10e5CndCwxGwMkvJMQHwei/EkjCFc6adl7oz/G6h 478Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=JtW0092cY3FcIFUZ4ZZkFIyyHeLu0WOvrJ7ycJjXsJg=; b=TOgOa/yzFt0gLTJlJQUholV6f+u1v9oHT+QUefUETNsBbQNZgu+Svgqj3KE7IKJMwy DU4JCPNIfkdhvpXuxFj0+74JV2mHKGv3kdEv4gm+DM9zP4uJ+qYm1hxi4DsR2rvzRjwU L2GNjewAM0P/aAMyswW1qzznn7bEP2MlqffW/tIwdXgmYEuqvEMt7xhuQX2DT6YbC85m rw31K2Yfv6NmkNYDGuy8Peg0I4ySOeYAsLyZPsSLFXoHo9yHzwPDPDexWvhv5aDfZE7K ICCEGpeOi/Ch12uLn4dPDXPh+spj4T61ifKXayTq789dWCjNSPWietL7D/WBIOQTMScV Pb6w== 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 c11si7942921edy.222.2021.01.18.17.05.04; Mon, 18 Jan 2021 17:05:30 -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 S1733285AbhARIRF (ORCPT + 99 others); Mon, 18 Jan 2021 03:17:05 -0500 Received: from verein.lst.de ([213.95.11.211]:46965 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733169AbhARIRA (ORCPT ); Mon, 18 Jan 2021 03:17:00 -0500 Received: by verein.lst.de (Postfix, from userid 2407) id 3085367373; Mon, 18 Jan 2021 09:16:16 +0100 (CET) Date: Mon, 18 Jan 2021 09:16:15 +0100 From: Christoph Hellwig To: Oliver Giles Cc: linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Christoph Hellwig , Linus Torvalds , Al Viro Subject: Re: Splicing to/from a tty Message-ID: <20210118081615.GA1397@lst.de> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jan 16, 2021 at 08:35:41PM +1300, Oliver Giles wrote: > Commit 36e2c7421f02 (fs: don't allow splice read/write without explicit ops) broke my userspace application which talks to an SSL VPN by splice()ing between "openssl s_client" and "pppd". The latter operates over a pty, and since that commit there is no fallback for splice()ing between a pipe and a pty, or any tty for that matter. > > The above commit mentions switching them to the iter ops and using generic_file_splice_read. IIUC, this would require implementing iter ops also on the line disciplines, which sounds pretty disruptive. > > For my case, I attempted to instead implement splice_write and splice_read in tty_fops; I managed to get splice_write working calling ld->ops->write, but splice_read is not so simple because the tty_ldisc_ops read method expects a userspace buffer. So I cannot see how to implement this without either (a) using set_fs, or (b) implementing iter ops on all line disciplines. set_fs is gone for all the important platforms. So yes, you basically need to convert to iov_iter or have a huge splice_write parallel infrastucture. > > Is splice()ing between a tty and a pipe worth supporting at all? Not a big deal for my use case at least, but it used to work. Our normal policy is no regressions for exiting userspace. By that we'd have to fix it. Let me see if I can help you with this in any way.