From patchwork Wed Nov 9 17:33:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 9419897 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CBFFB601C0 for ; Wed, 9 Nov 2016 17:47:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF3592911A for ; Wed, 9 Nov 2016 17:47:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B35AD2935C; Wed, 9 Nov 2016 17:47:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 22ABB2911A for ; Wed, 9 Nov 2016 17:47:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753428AbcKIRri (ORCPT ); Wed, 9 Nov 2016 12:47:38 -0500 Received: from mail-it0-f68.google.com ([209.85.214.68]:36733 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752977AbcKIRri (ORCPT ); Wed, 9 Nov 2016 12:47:38 -0500 Received: by mail-it0-f68.google.com with SMTP id n68so15908799itn.3; Wed, 09 Nov 2016 09:47:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:from:to:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=iyrnnq9UZff2QYFe3lcZnxFmQGG9gNpT9gbZnQIaSok=; b=KF0ZaREjXQh4edwXL2sGeLL01YGjYbcIYzTwceZr29CURBpvPEuuNC4HdDGVyQFabk ebDdywAWZttQgs8OIXJmHe/+XEl3AEwOr5FNiYzK7puft7Y+5TGn//Zpe5ZBKPygleWP qGMi6poJQfj/u3R796+I8N2jSZrZdJgIpBWDFsTn7bF7RBVR0SL5pCrUldBsQF/f3AG+ 2bvILzReeKUSSbhYBsBAgl8RE3zrPaLdeEj8E0YvJb9HmRTQYtw/CJLTR6sEpLN+henT 2sLytDFy03XDlfTXeM/2eWMSPVNyZswgvNHY94VJs/S5IaPhpTpKyVr+d/wHhpIG0e1r i41A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:from:to:date:message-id :in-reply-to:references:user-agent:mime-version :content-transfer-encoding; bh=iyrnnq9UZff2QYFe3lcZnxFmQGG9gNpT9gbZnQIaSok=; b=IL0XjEbnv68ZsOEt5tpYXken7/y1r/Pwj5/QTQOV37sZYK2nWvI1caxFwkOy/ga4TW f5ZZLBU2BzIAxmeuk208HVGR/R9qHiktdeADiCXPtSzgdNYLwkv/8/dOYGe8ZCf/4EgD IrF278kIy2gyhB5bjzTiRniCbbO95aFZrOaSvPwAkkskDKoyJlSQABR9S8ZNLcmo+tFa 150mOj7ZbJAT4LYXlxWffcKZuMvl+xSChIWjvfs2ovchJUquJwnuz4pahby1V0i70LJM Phhn5DH84TqIr7Tq6CMl11Kt4tYccksHE1kDKXlvumJ/bWEwI8Zzlk7krQ0W79GUxShK 904w== X-Gm-Message-State: ABUngvcXlyUgycRTiA2Oh2vSixB02s+qkXxZDLFt1/oV0J2wwkjdnYpUht5f+HzetwnZqg== X-Received: by 10.107.31.194 with SMTP id f185mr1494229iof.100.1478712835390; Wed, 09 Nov 2016 09:33:55 -0800 (PST) Received: from klimt.1015granger.net ([2604:8800:100:81fc:ec4:7aff:fe6c:6aa0]) by smtp.gmail.com with ESMTPSA id n131sm417528itb.20.2016.11.09.09.33.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Nov 2016 09:33:55 -0800 (PST) Subject: [PATCH v1 2/7] svcauth_gss: Close connection when dropping an incoming message From: Chuck Lever To: linux-rdma@vger.kernel.org, linux-nfs@vger.kernel.org Date: Wed, 09 Nov 2016 12:33:54 -0500 Message-ID: <20161109173354.15735.87424.stgit@klimt.1015granger.net> In-Reply-To: <20161109165814.15735.47815.stgit@klimt.1015granger.net> References: <20161109165814.15735.47815.stgit@klimt.1015granger.net> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP S5.3.3.1 of RFC 2203 requires that an incoming GSS-wrapped message whose sequence number lies outside the current window is dropped. The rationale is: The reason for discarding requests silently is that the server is unable to determine if the duplicate or out of range request was due to a sequencing problem in the client, network, or the operating system, or due to some quirk in routing, or a replay attack by an intruder. Discarding the request allows the client to recover after timing out, if indeed the duplication was unintentional or well intended. However, clients may rely on the server dropping the connection to indicate that a retransmit is needed. Without a connection reset, a client can wait forever without retransmitting, and the workload just stops dead. I've reproduced this behavior by running xfstests generic/323 on an NFSv4.0 mount with proto=rdma and sec=krb5i. To address this issue, have the server close the connection when it silently discards an incoming message due to a GSS sequence number problem. There are a few other places where the server will never reply. Change those spots in a similar fashion. Signed-off-by: Chuck Lever --- net/sunrpc/auth_gss/svcauth_gss.c | 2 +- net/sunrpc/svc.c | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c index 45662d7..886e9d38 100644 --- a/net/sunrpc/auth_gss/svcauth_gss.c +++ b/net/sunrpc/auth_gss/svcauth_gss.c @@ -1548,7 +1548,7 @@ static void destroy_use_gss_proxy_proc_entry(struct net *net) {} ret = SVC_COMPLETE; goto out; drop: - ret = SVC_DROP; + ret = SVC_CLOSE; out: if (rsci) cache_put(&rsci->h, sn->rsc_cache); diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index 7c8070e..75f290b 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c @@ -1155,8 +1155,7 @@ static __printf(2,3) void svc_printk(struct svc_rqst *rqstp, const char *fmt, .. case SVC_DENIED: goto err_bad_auth; case SVC_CLOSE: - if (test_bit(XPT_TEMP, &rqstp->rq_xprt->xpt_flags)) - svc_close_xprt(rqstp->rq_xprt); + goto close; case SVC_DROP: goto dropit; case SVC_COMPLETE: @@ -1246,7 +1245,7 @@ static __printf(2,3) void svc_printk(struct svc_rqst *rqstp, const char *fmt, .. sendit: if (svc_authorise(rqstp)) - goto dropit; + goto close; return 1; /* Caller can now send it */ dropit: @@ -1254,11 +1253,16 @@ static __printf(2,3) void svc_printk(struct svc_rqst *rqstp, const char *fmt, .. dprintk("svc: svc_process dropit\n"); return 0; + close: + if (test_bit(XPT_TEMP, &rqstp->rq_xprt->xpt_flags)) + svc_close_xprt(rqstp->rq_xprt); + dprintk("svc: svc_process close\n"); + return 0; + err_short_len: svc_printk(rqstp, "short len %Zd, dropping request\n", argv->iov_len); - - goto dropit; /* drop request */ + goto close; err_bad_rpc: serv->sv_stats->rpcbadfmt++;