From patchwork Wed May 31 12:45:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13262144 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0D4CC77B73 for ; Wed, 31 May 2023 12:45:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 60CFD8E0006; Wed, 31 May 2023 08:45:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 596598E0002; Wed, 31 May 2023 08:45:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 45E6D8E0006; Wed, 31 May 2023 08:45:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 364518E0002 for ; Wed, 31 May 2023 08:45:43 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 0982A16015D for ; Wed, 31 May 2023 12:45:43 +0000 (UTC) X-FDA: 80850521766.02.A8CFF97 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf18.hostedemail.com (Postfix) with ESMTP id 951421C001B for ; Wed, 31 May 2023 12:45:39 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="K/0EzIMW"; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf18.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1685537139; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=B4bV2oROch/HC6XHubXydMRA7S2+n/L3VG/EIF3GuPE=; b=RAngraRD3B+MtZZ7ACohxB0zqYefvNs1U/MPqNZLj499JueO/wEQa5J/V4Psi02k4p12JA ZDr3s1Zx8lD4Jza0Fd0uza0dndyKMyDURJWt7y/BYEJG9aNbMfD5jya8r0pK+OHE1wsWWn CkdabFWQagd/oYwbfJlqTSqar7SBkm0= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="K/0EzIMW"; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf18.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1685537139; a=rsa-sha256; cv=none; b=6rFEr4nF64xrF/Jbi+RGrjRMEc8qFyEbHD1txhPsisrEOpB/1xKzdGnJlvpRhkmUIMbmhr pzfhCMouRIesIwcEdop269d7OaUfTy8NFxOtUAP6BHhyVE5jYg0XQRUYM6/bLw/5bJjkuE vjlj72NSqBOHLq06PweTGuusWVeaV8U= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685537138; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=B4bV2oROch/HC6XHubXydMRA7S2+n/L3VG/EIF3GuPE=; b=K/0EzIMW4aSCnVpI9yu/WRon9grmHMyK1FyLSJp+wT6IQhl24V+NIbh67B+piZFs26ueJo xHViugvTZ30X+b7EVR86GaXvcOq2TSsq8QZEp2i+joI6CGRMglVN5/G0bkvZer9BX+MhkX gLO18u0SUxh2tBQljSJg8s5KbvVLh+c= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-613--ohwPo-MMEyGn577YeFRZA-1; Wed, 31 May 2023 08:45:33 -0400 X-MC-Unique: -ohwPo-MMEyGn577YeFRZA-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D7588185A793; Wed, 31 May 2023 12:45:32 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.182]) by smtp.corp.redhat.com (Postfix) with ESMTP id E8A25492B0A; Wed, 31 May 2023 12:45:30 +0000 (UTC) From: David Howells To: netdev@vger.kernel.org Cc: David Howells , Chuck Lever , Boris Pismenny , John Fastabend , Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Willem de Bruijn , David Ahern , Matthew Wilcox , Jens Axboe , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 0/6] splice, net: Handle MSG_SPLICE_PAGES in AF_TLS Date: Wed, 31 May 2023 13:45:22 +0100 Message-ID: <20230531124528.699123-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 951421C001B X-Stat-Signature: ftbqh3d5e7kbb7qng13seazf9bxe416c X-Rspam-User: X-HE-Tag: 1685537139-969514 X-HE-Meta: U2FsdGVkX18NcPpMfkxVR1kuZ7h4M1JR6AZV0e4VNuqLo/bCe3WMjVID5TetLgILiw2iNgzbovfRzHSgvhtsdZUuB5XbJ53ul0c8g+6mSO2DL1QRMFWnV/spVpPXrBlGRonDqQeWmFfQG8FfVmV08HEIl9USXkRTTMcxzkhqBOcCmJ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qbxGFBX+Jm0Br2TpSQNwvnn/V8VB4MyBO+GdvO2wsvB+4Rh3lxesffoOvzJRVZH442CdUs3C7ZxXGf0ogl7l7IQD2fwD5SjorqZWXpUtsWCrC/uRbgkA+Kvybl+tLac4WB52pl8lYh4+DbH86SMd0xgpx0FNg X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Here are patches to make AF_TLS handle the MSG_SPLICE_PAGES internal sendmsg flag. MSG_SPLICE_PAGES is an internal hint that tells the protocol that it should splice the pages supplied if it can. Its sendpage implementations are then turned into wrappers around that. The following changes are made: (1) The first patch fixes MSG_MORE signalling in splice_direct_to_actor(). The problem is that MSG_MORE is asserted if a short splice from a file occurs because we hit the EOF[1]. This is fixed by checking the EOF if the file is seekable. (2) Implement MSG_SPLICE_PAGES support in the AF_TLS-sw sendmsg and make tls_sw_sendpage() just a wrapper around sendmsg(). (3) Implement MSG_SPLICE_PAGES support in AF_TLS-device and make tls_device_sendpage() just a wrapper around sendmsg(). I've pushed the patches here also: https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/log/?h=sendpage-2-tls David Changes ======= ver #2) - Dropped the slab data copying. - "rls_" should be "tls_". - Attempted to fix splice_direct_to_actor(). - Blocked MSG_SENDPAGE_* from being set by userspace. Link: https://lore.kernel.org/r/499791.1685485603@warthog.procyon.org.uk/ [1] Link: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=51c78a4d532efe9543a4df019ff405f05c6157f6 # part 1 Link: https://lore.kernel.org/r/20230524153311.3625329-1-dhowells@redhat.com/ # v1 David Howells (6): splice, net: Fix MSG_MORE signalling in splice_direct_to_actor() net: Block MSG_SENDPAGE_* from being passed to sendmsg() by userspace tls/sw: Support MSG_SPLICE_PAGES tls/sw: Convert tls_sw_sendpage() to use MSG_SPLICE_PAGES tls/device: Support MSG_SPLICE_PAGES tls/device: Convert tls_device_sendpage() to use MSG_SPLICE_PAGES fs/splice.c | 17 +++- include/linux/socket.h | 4 +- net/tls/tls_device.c | 94 ++++++++---------- net/tls/tls_sw.c | 211 +++++++++++++++-------------------------- 4 files changed, 131 insertions(+), 195 deletions(-)