Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp136492iob; Wed, 27 Apr 2022 21:46:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOlkOvoP2sKD5Jln/b9WkGwZU8hIcvDsg6ccG953sfZzQwa1rWPwRvJi8Hax8aeypTqNfO X-Received: by 2002:a17:90b:33cc:b0:1ce:a3fe:af41 with SMTP id lk12-20020a17090b33cc00b001cea3feaf41mr36849752pjb.229.1651121189683; Wed, 27 Apr 2022 21:46:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651121189; cv=none; d=google.com; s=arc-20160816; b=JhUOnQnu5BSGsN/NZFCpDV6hPtwCIGEiyvwDnAha9ypHDDP2mzd76ULwfHwV7EL3n6 eLrI/U0LYth/YqsC3qIBEO+37IpiK57klZiDAD7HjobmVwWYw4sFuTSxrZuRZ2SH+wji GSmhqj/gbr0Keisfl8tPuxaya9R6o68jeZWF1006Dgk8YhtZPVJrdlWqsUmbfsBoWv+t /SnvcrhXnVmuiGnaTlaFn4hP1IT8tEY6WTc/FwLUBvUIAlsWSxghdCYMZBpdcHnJ1Xek H+UB2sFqdCjrVqTkh62Leu2L84tHAtMsnGWBwf7GKWJ/RA5vLmYwKWve1TJKAdZCEClK 6lmA== 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:subject:cc:to:from:date :dkim-signature; bh=MqA/rz+LNdKVBxm1HPYd8aa5eey7+SF4/KR6Eex7oZE=; b=tatNYX0UeGNpVB7YIqXdcPW0LVbzERfq4kJu9Vfz44PxYiR4Hl2DWz300j9vkyW9kH 8quDBaBU4pJrfSuRwzkG7o35pFuQFjkVJ0X7Kt5/DBD/Tqvzp2ved4/kKuxmQ6vh+g1y qbUcHz6rXq6Wu1z6sF4bYm2aXOnxMWXKjyWrwbrjFVfpheOGd1/NfuqnMTQJODPMu262 KyM4oeHTFrg/JSqFlHyklS0qNju2gluNHUWTJIXYjGuHu2rhD683BDrDIraV6HKQlMvL 6zU/izvYCyLyjpDdS9PyDaYWWR17UaCZSoIptsbj+giVqxSxjOrZQUkq0S6EWH9DIchT Vzsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jkk2Utcn; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k14-20020a170902ce0e00b0015866d0a301si3769885plg.399.2022.04.27.21.46.01; Wed, 27 Apr 2022 21:46:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jkk2Utcn; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230298AbiD0X5K (ORCPT + 99 others); Wed, 27 Apr 2022 19:57:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229700AbiD0X5J (ORCPT ); Wed, 27 Apr 2022 19:57:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 050E110D; Wed, 27 Apr 2022 16:53:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 92C8E614A5; Wed, 27 Apr 2022 23:53:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65FB2C385AA; Wed, 27 Apr 2022 23:53:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651103635; bh=EamM+bDxfmz3jX7DrFUs3xgkTXROOpZ4JGaFwQ/Y3QU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=jkk2UtcnFpqH2EH/z/QO9z9LQjKzH/QcWW2kvHc8mAZ6iFYGo2oF2Fb4B098XDJQC 1aoSrEGmG1FgiKIJ/vQorRIubhuqrGKFBe9MX1ZhuKDiS3O92ZeO29NrgMrzpEhKox q7QNF5+FXLQ8L8aUAnnztQcK7ZQ03eDo1YBUEjxYFLXgWEGjoIJa3M9SEyPjT488+7 papRiV/xuEq7oEAtExC7N33MSGxKUcRGxgwdbRAp3iYNLBXHCFKwAsMNa4T6mMQjWw UBz/7/LDIDJYKRvijouRlQP491ut7nCfIVYdfRr4uuTz1cGkSBxLs0rex7ycgK5ydZ 2Mfef0uyZTj/g== Date: Wed, 27 Apr 2022 16:53:54 -0700 From: Jakub Kicinski To: Chuck Lever III Cc: netdev , Linux NFS Mailing List , "linux-nvme@lists.infradead.org" , "linux-cifs@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "ak@tempesta-tech.com" , "borisp@nvidia.com" , "simo@redhat.com" Subject: Re: [PATCH RFC 4/5] net/tls: Add support for PF_TLSH (a TLS handshake listener) Message-ID: <20220427165354.2eed6c5b@kernel.org> In-Reply-To: <7B871201-AC3C-46E2-98B0-52B44530E7BD@oracle.com> References: <165030051838.5073.8699008789153780301.stgit@oracle-102.nfsv4.dev> <165030059051.5073.16723746870370826608.stgit@oracle-102.nfsv4.dev> <20220425101459.15484d17@kernel.org> <20220426075504.18be4ee2@kernel.org> <20220426164712.068e365c@kernel.org> <7B871201-AC3C-46E2-98B0-52B44530E7BD@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Wed, 27 Apr 2022 14:42:53 +0000 Chuck Lever III wrote: > > On Apr 26, 2022, at 7:47 PM, Jakub Kicinski wrote: > >> RPC-with-TLS requires one RPC as a "starttls" token. That could be > >> done in user space as part of the handshake, but it is currently > >> done in the kernel to enable the user agent to be shared with other > >> kernel consumers of TLS. Keep in mind that we already have two > >> real consumers: NVMe and RPC-with-TLS; and possibly QUIC. > >> > >> You asserted earlier that creating sockets in user space "scales > >> better" but did not provide any data. Can we see some? How well > >> does it need to scale for storage protocols that use long-lived > >> connections? > > > > I meant scale with the number of possible crypto protocols, > > I mentioned three there. > > I'm looking at previous emails. The "three crypto protocols" > don't stand out to me. Which ones? TLS, QUIC and PSP maybe that was in a different email that what you quoted, sorry: https://lore.kernel.org/all/20220426080247.19bbb64e@kernel.org/ PSP: https://raw.githubusercontent.com/google/psp/main/doc/PSP_Arch_Spec.pdf > The prototype has a "handshake type" option that enables the kernel > to request handshakes for different transport layer security > protocols. Is that the kind of scalability you mean? > > For TLS, we expect to have at least: > > - ClientHello > - X509 > - PSK > - ServerHello > - Re-key > > It should be straightforward to add the ability to service > other handshake types. > > >> I can include unit tests with the prototype. Someone needs to > >> educate me on what is the preferred unit test paradigm for this > >> type of subsystem. Examples in the current kernel code base would > >> help too. > > > > Whatever level of testing makes you as an engineer comfortable > > with saying "this test suite is sufficient"? ;) > > > > For TLS we have tools/testing/selftests/net/tls.c - it's hardly > > an example of excellence but, you know, it catches bugs here and > > there. > > My question wasn't clear, sorry. I meant, what framework is > appropriate to use for unit tests in this area? Nothing area specific, tools/testing/selftests/kselftest_harness.h is what the tls test uses. > >> When we started discussing TLS handshake requirements with some > >> community members several years ago, creating the socket in > >> kernel and passing it up to a user agent was the suggested design. > >> Has that recommendation changed since then? > > > > Hm, do you remember who you discussed it with? Would be good > > to loop those folks in. > > Yes, I remember. Trond Myklebust discussed this with Dave Miller > during a hallway conversation at a conference (probably Plumbers) > in 2018 or 2019. > > Trond is Cc'd on this thread via linux-nfs@ and Dave is Cc'd via > netdev@. > > I also traded email with Boris Pismenny about this a year ago, > and if memory serves he also recommended passing an existing > socket up to user space. He is Cc'd on this directly. I see. > > I wasn't involved at the beginning of the > > TLS work, I know second hand that HW offload and nbd were involved > > and that the design went thru some serious re-architecting along > > the way. In the beginning there was a separate socket for control > > records, and that was nacked. > > > > But also (and perhaps most importantly) I'm not really objecting > > to creating the socket in the kernel. I'm primarily objecting to > > a second type of a special TLS socket which has TLS semantics. > > I don't understand your objection. Can you clarify? > > AF_TLSH is a listen-only socket. It's just a rendezvous point > for passing a kernel socket up to user space. It doesn't have > any particular "TLS semantics". It's the user space agent > listening on that endpoint that implements particular handshake > behaviors. > > In fact, if the name AF_TLSH gives you hives, that can be made > more generic. Yes, a more generic "user space please bake my socket" interface is what I'm leaning towards. > However, that makes it harder for the kernel to > figure out which listening endpoint handles handshake requests. Right, the listening endpoint... Is it possible to instead create a fd-passing-like structured message which could carry the fd and all the relevant context (what goes via the getsockopt() now)? The user space agent can open such upcall socket, then bind to whatever entity it wants to talk to on the kernel side and read the notifications via recv()?