Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4427212rwd; Tue, 23 May 2023 07:36:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5vcDQGT6KokaSVau+zYrsBMXkgzSeWVhYjwTKVPCzPsdHkk9FPXfgr9ip/R3Hp1iLI0Bar X-Received: by 2002:a17:902:64d6:b0:1af:d750:10cb with SMTP id y22-20020a17090264d600b001afd75010cbmr424964pli.63.1684852601534; Tue, 23 May 2023 07:36:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684852601; cv=none; d=google.com; s=arc-20160816; b=eo8yTZPSVYS1JdF36tR12hq2WVUwzt9JL1t83loJfvXO46/HkRlqdhz7Df6hPc6ovx /RNykCd4bkFWuANlFw0ZnCpX45r6hOMdFYxKr19Eh2p3piGtYywRLeUocbYWZ2VyyPPA hAWv/4ryp8EZKpg2xkLG0ritbnm+xM86ixcL77NeImmDdcgeCMYADrycsaNp9hxCpUBx WhIvI3SkJrshe2mANbm70aUIV+vmejz7M+Qy051yTgYsisJRUAt0gW3EsDvSZeDR7OPU i6h080CQTHDGQUL3cKeqDx3319l48ZEZnD11EbGdD/k00FqNBEWRXx6rCib6TQCTyMKD wlRA== 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 :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=CeQWOfnouE9sGSDgeXEB30i3oYOk8CgB9M/EeKf55Pw=; b=EX+Ece8s8tx80W9sVYj87UaBngEOQDj4OYbMBwjfjbseJLv+LJHeHIRBIrgV8c2HfT 88PNNGlZzxN6hbmRV5E9IiAkTW01R3uDpUJ3+oB5sQlZbF/HWWLB50dxK1tmstTHtP95 sobvB20lP5R+n+n5Ui+b9gG0p0jVGZdvzMT5UIYhaOlJ58KsGCJSZSmcXeeya4XTN4MF RNS9828FySFS2bjEbsoC5bwFAUjcbQkUUDd+bH2hj3pt6KTkbSeQyt7MSAmHUgEBI81/ FXRThtoSMKJff+xO5jiPJQcNd6SRZdszFlpdSS1BGA8kYULpjRXdPkk5WYlwyfrNKU0M ntfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aIO767Ri; 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 4-20020a170902c24400b001ac83d19265si1103443plg.291.2023.05.23.07.36.28; Tue, 23 May 2023 07:36:41 -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=aIO767Ri; 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 S235707AbjEWOb5 (ORCPT + 99 others); Tue, 23 May 2023 10:31:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236103AbjEWOb4 (ORCPT ); Tue, 23 May 2023 10:31:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4190ADB for ; Tue, 23 May 2023 07:31:55 -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 CAB5C63316 for ; Tue, 23 May 2023 14:31:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9D76C433EF; Tue, 23 May 2023 14:31:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684852314; bh=Kyed/UbvWRho6vpmPpr7ylX/Da6hV2+VkFDzdFRluTc=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=aIO767Ri8579T4TTwhHHbuTYp7zqrzyDrHSOpIdLE2q+84/3qYpJ8+Xwou5vm9HA+ 5gkE5+QHZipFThefYfzI7cWTVD5kFq+fC6ZFQX89KdVyF3FzKfTOf8lq8pUZeOowFH or/V2NnZtD2ptoCI03xgeUgxfmjZOp5XF6RQqRPWib7lyR2gomCBRQBqgD62LGbJjY mGTPcWnfYM+CjlrRxAJUn4HovEADSkImvQvw1SVgsE4TVVaf1nfRGQHnfQPbjk+fks v2nSDXUuzhG6hX3QBT0kFKPuGzJ8NEZB4F5qNwHGkQ2WHl7b6OnT+zWYdrfC6qOynp Tq1/BQEJ+7CqA== Subject: [PATCH v2 05/11] SUNRPC: Ignore data_ready callbacks during TLS handshakes From: Chuck Lever To: anna.schumaker@netapp.com, trondmy@hammerspace.com Cc: Chuck Lever , Jeff Layton , jlayton@redhat.com, linux-nfs@vger.kernel.org, kernel-tls-handshake@lists.linux.dev Date: Tue, 23 May 2023 10:31:42 -0400 Message-ID: <168485230097.6613.15415182512136596528.stgit@oracle-102.nfsv4bat.org> In-Reply-To: <168485183242.6613.7025123558596119858.stgit@oracle-102.nfsv4bat.org> References: <168485183242.6613.7025123558596119858.stgit@oracle-102.nfsv4bat.org> User-Agent: StGit/1.5 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 From: Chuck Lever The RPC header parser doesn't recognize TLS handshake traffic, so it will close the connection prematurely with an error. To avoid that, shunt the transport's data_ready callback when there is a TLS handshake in progress. The XPRT_SOCK_IGNORE_RECV flag will be toggled by code added in a subsequent patch. Signed-off-by: Chuck Lever Reviewed-by: Jeff Layton --- include/linux/sunrpc/xprtsock.h | 1 + net/sunrpc/xprtsock.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/include/linux/sunrpc/xprtsock.h b/include/linux/sunrpc/xprtsock.h index 38284f25eddf..daef030f4848 100644 --- a/include/linux/sunrpc/xprtsock.h +++ b/include/linux/sunrpc/xprtsock.h @@ -90,5 +90,6 @@ struct sock_xprt { #define XPRT_SOCK_WAKE_DISCONNECT (7) #define XPRT_SOCK_CONNECT_SENT (8) #define XPRT_SOCK_NOSPACE (9) +#define XPRT_SOCK_IGNORE_RECV (10) #endif /* _LINUX_SUNRPC_XPRTSOCK_H */ diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 5f9030b81c9e..37f608c2c0a0 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c @@ -695,6 +695,8 @@ static void xs_poll_check_readable(struct sock_xprt *transport) { clear_bit(XPRT_SOCK_DATA_READY, &transport->sock_state); + if (test_bit(XPRT_SOCK_IGNORE_RECV, &transport->sock_state)) + return; if (!xs_poll_socket_readable(transport)) return; if (!test_and_set_bit(XPRT_SOCK_DATA_READY, &transport->sock_state)) @@ -1380,6 +1382,10 @@ static void xs_data_ready(struct sock *sk) trace_xs_data_ready(xprt); transport->old_data_ready(sk); + + if (test_bit(XPRT_SOCK_IGNORE_RECV, &transport->sock_state)) + return; + /* Any data means we had a useful conversation, so * then we don't need to delay the next reconnect */