Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4563504rwd; Tue, 30 May 2023 07:08:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4I7GfGOd+w9Sj2yvejb9AQixrduBbN76kkPfHA+It64vvQkDg89tgHY00BkoQ90XpAwPat X-Received: by 2002:a17:90a:560a:b0:256:cbe9:83c2 with SMTP id r10-20020a17090a560a00b00256cbe983c2mr1428172pjf.38.1685455695477; Tue, 30 May 2023 07:08:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685455695; cv=none; d=google.com; s=arc-20160816; b=ROUqsbyxEIkY9Jb/b1kbhGjtqkAk5xGY4W3aVYl6/NgniFLyYaGCRJHnVWV8a8ig0Y AMAIZwYmM1ZQuNdhnBNjUV6FuPFwtWlV/xKAdxLmJM9jd0+8+FscWbwpmqjk2eEAYT4F BQgk6K4nm8Qov+EARGX34hB4qXGir32TeIRNa2LA020xrd2NpHR+uOvYpAdnyC8DZybA /AJiB+8kw87SGDlHv0091CduDK36KGpAG+HK2fSjFcuffMU7ftnq2SYTtioJ1Kh2fNSy 2q52T76XCNmn+MLsvVvolPNIIjTMQZ2pGpspaXyshIvHxZNAZRp3PP5XozakEMtKr/bN HlqA== 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=Mf43Ido930lGYy0qXKU6RqdloFHcLyG4TZlztc0CWfmGo4nonQELPxuI0+3zrtWiH0 dLYOEkt1boNgjMk4x0AKyIZIVLlkfUFmZis0wx74XNLe7HcOWZ9rWS1IKF1rAE3TzVil /zccr4WiCUbCx2PSdqsg7dR6JqdYNLMyC4NSVlK0Np3qLPa2EQXFNmqZ5K0rfyqL78MF QHNQ/pIW4OlBWbt9dp9b3u5xLhquYRqdz7BcaRH44IPsTPaUJZpKfY/22hauZbZVRvIH fxG7rqtEejDScpk1ttBAJneHlnoBwDRs/32OVFxDBQBCPgmnf7hGFWDdfcQd904CGJDk OvCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ARUshBiC; 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 ds2-20020a17090b08c200b0024e500f3749si13659472pjb.68.2023.05.30.07.08.01; Tue, 30 May 2023 07:08:15 -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=ARUshBiC; 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 S232909AbjE3OH3 (ORCPT + 99 others); Tue, 30 May 2023 10:07:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232911AbjE3OH2 (ORCPT ); Tue, 30 May 2023 10:07:28 -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 0AE18D9 for ; Tue, 30 May 2023 07:07:28 -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 945C4630CC for ; Tue, 30 May 2023 14:07:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CF71C433EF; Tue, 30 May 2023 14:07:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685455647; bh=Kyed/UbvWRho6vpmPpr7ylX/Da6hV2+VkFDzdFRluTc=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=ARUshBiCW88hfTpqzspXs3PR47AJYk3fV9S3YxpeHtjmFm4rskaXxdDbHXj7nmp+X S8kjI2edxBMdCrf2373fAhzD8hmNwT19d6BOoY/2zEu+6p+TzOZRHyqadd36SRE4KH 3WLeWCYpzQg2FtSz3rIouFlG6aWwIA+PIt6hoD9ylfKrKFZ994XvsrYcCOI635pXRy koHBKuX8ot8Wc+mSeFrOfjqaCTPrQalQ4rYNKwlj8QY8uCkMS/rP2dEQ5osGo7TWlO hUFVJkJlpYJ3A1tZhgWx2GG6+ZTMTBcY7xwRzUrZChT0IXuG9qQd8W5kYeYskjcQfT 5IZehF5q7nu4A== Subject: [PATCH v3 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, 30 May 2023 10:07:15 -0400 Message-ID: <168545563400.1917.12895266351746616109.stgit@oracle-102.nfsv4bat.org> In-Reply-To: <168545533442.1917.10040716812361925735.stgit@oracle-102.nfsv4bat.org> References: <168545533442.1917.10040716812361925735.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.6 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 */