From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5EE5FC433DB for ; Mon, 18 Jan 2021 08:17:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 38A5E22525 for ; Mon, 18 Jan 2021 08:17:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387634AbhARIRK (ORCPT ); Mon, 18 Jan 2021 03:17:10 -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.