Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp716960ybz; Wed, 15 Apr 2020 17:23:39 -0700 (PDT) X-Google-Smtp-Source: APiQypIy8tnrJQXl7zxwvfFvt5wEr3156sofqbKeGUb0yhUcqiHXddKMNd1ZnV5XW6ZNnCumekkF X-Received: by 2002:a17:906:af6f:: with SMTP id os15mr7529649ejb.78.1586996618912; Wed, 15 Apr 2020 17:23:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586996618; cv=none; d=google.com; s=arc-20160816; b=uy6/dkogcQVDHNj2NS8NFyv0I2HnfKjCk+Rfiyh3vkWylIP6b3FK1yEvFNg2Xofzyd 51YeyMMz8B+i37ZOYP4nBQJG+XRuaOZm2T/M3xsZbbuYiRYZB5L5oIhGqGVcEdOFOqs1 CK8Y0EdvXIQh47XMYxP4JvtQRLH3u5fhb6Fa3UWrPLFpqBjOJtDI2l42MaANn94tRvhf xMaqF2YkQ7PkWvmS07gOmFWiWnkKsLRwn5Nox082n90ZtLYSABXXGJE7D25hehtjX2zd fvGWGdfhhSDF0pVUpchs+irV4SqsoGV15JUg9oDnjnkdQtxIfEO1num2hH+lwXQG7sb1 XZrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:cc:date:message-id:subject :mime-version:content-transfer-encoding:from:dkim-signature; bh=0mQ2OXjVFtnaj2pJ4iOC+jroIdIvRERqU/aiEEcQzNc=; b=cvHb7RAiQ2AGKyseB0tqNXjNizmbNJg7GsQUmg6vW7khR0Ob8Gf4STxtjJal3Vks5O bmM7B9kiJz08rphPAiHWOpWcIqTrnLBSaVkd5r4/Fivhe2y2UcDS/bte8yfy4LgawkWM YQiQbXpyf16yC28jbw2ByeB5Z6BUWWF5eOfaGygx1fRkifuRR08/48/6y0B7RDleomnX BCua1e7ilatyrNdCX99iWRN+uCAnoKcjvfpVhKODZyikHnDaVZAQYvbO06ENc6FIPyKL E4Kh1EnNgC+wsMzyRZmE117cMvoZ34V4foKPrr/27EpTDa9fl0w6fVZQOu8DwmZcPbcS uzmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=jY5ZEd6T; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cx7si6276175edb.125.2020.04.15.17.23.06; Wed, 15 Apr 2020 17:23:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=jY5ZEd6T; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2410659AbgDORFZ (ORCPT + 99 others); Wed, 15 Apr 2020 13:05:25 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:34316 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2410664AbgDORFX (ORCPT ); Wed, 15 Apr 2020 13:05:23 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 03FH44wK062964; Wed, 15 Apr 2020 17:05:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : content-type : content-transfer-encoding : mime-version : subject : message-id : date : cc : to; s=corp-2020-01-29; bh=0mQ2OXjVFtnaj2pJ4iOC+jroIdIvRERqU/aiEEcQzNc=; b=jY5ZEd6TRPLGQRV11gKHnoryEh8ppf37KbvsXuj71XVrUiHuFZ4hRPfQrr/L0LsfJL57 SPQ46t27tKDlxSz0G4/ZwdotXyas9tQ85d/cwR9THsvQmtGv0wRn43pn4Mugmx+MiuSP +pOZVlt9R5m/Oy+bWmkU7u+npvXftiDLRzN/nDBgz7if3HuvEal2WAydrdaNjcOMgf9s igREyyr9Of9pYqSH5R2XGAzG0CLjATPYPjFpLbJgG7B2hZmkRNkL0+OblsdvyNfbcVYK 3xjzLi0CitdET2j9zu5czavRc3cdeqxkFTJzXI/lJDbbVtYzL2XGiIeIYOOfVuUTPH/w RA== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 30e0bfa6j9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Apr 2020 17:05:18 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 03FH3CGQ002716; Wed, 15 Apr 2020 17:05:17 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3030.oracle.com with ESMTP id 30dn8wm8fd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Apr 2020 17:05:17 +0000 Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 03FH5ERu032441; Wed, 15 Apr 2020 17:05:15 GMT Received: from anon-dhcp-153.1015granger.net (/68.61.232.219) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 15 Apr 2020 10:05:14 -0700 From: Chuck Lever Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: GSS unwrapping breaks the DRC Message-Id: Date: Wed, 15 Apr 2020 13:05:11 -0400 Cc: Linux NFS Mailing List To: Bruce Fields , Jeff Layton X-Mailer: Apple Mail (2.3445.104.11) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9592 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 mlxlogscore=809 suspectscore=0 malwarescore=0 spamscore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004150124 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9592 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 clxscore=1015 priorityscore=1501 mlxscore=0 lowpriorityscore=0 mlxlogscore=848 impostorscore=0 adultscore=0 suspectscore=0 phishscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004150124 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Hi Bruce and Jeff: Testing intensive workloads with NFSv3 and NFSv4.0 on NFS/RDMA with krb5i or krb5p results in a pretty quick workload failure. Closer examination shows that the client is able to overrun the GSS sequence window with some regularity. When that happens, the server drops the connection. However, when the client retransmits requests with lost replies, they never hit in the DRC, and that results in unexpected failures of non- idempotent requests. The retransmitted XIDs are found in the DRC, but the retransmitted request has a different checksum than the original. We're hitting the "mismatch" case in nfsd_cache_key_cmp for these requests. I tracked down the problem to the way the DRC computes the length of the part of the buffer it wants to checksum. nfsd_cache_csum uses head.iov_len + page_len and then caps that at RC_CSUMLEN. That works fine for krb5 and sys, but the GSS unwrap functions (integ_unwrap_data and priv_unwrap_data) don't appear to update head.iov_len properly. So nfsd_cache_csum's length computation is significantly larger than the clear-text message, and that allows stale parts of the xdr_buf to be included in the checksum. Using xdr_buf_subsegment() at the end of integ_unwrap_data sets the xdr_buf lengths properly and fixes the situation for krb5i. I don't see a similar solution for priv_unwrap_data: there's no MIC len available, and priv_len is not the actual length of the clear-text message. Moreover, the comment in fix_priv_head() is disturbing. I don't see anywhere where the relationship between the buf's head/len and how svc_defer works is authoritatively documented. It's not clear exactly how priv_unwrap_data is supposed to accommodate svc_defer, or whether integ_unwrap_data also needs to accommodate it. So I can't tell if the GSS unwrap functions are wrong or if there's a more accurate way to compute the message length in nfsd_cache_csum. I suspect both could use some improvement, but I'm not certain exactly what that might be. -- Chuck Lever