Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796495970; b=NEWqdv1xvNVeNT1arhPvfwsKcHiOeMoSqZtqj1DhUYhZ4+DcwwRICY2nHNxrx+8scMFs R1rMcW0y4LTXhFbY0ogK1ImYQQ1fSR12ySYlz/P3Iryy7eqcME/KuazgPa++dHVlBQ5uv G9kP8/KKhYv1SSgqd3Uq7uE2ey3j/2LT7jNjhkB/ID3WpBRig05oYxMikROaB6K+rBqhv ANQo49JRQMZcxIP/ou9q57ksAzUm5k3VHN7MxItMA/UadwsDYv1qffQFvGdgWMdKnauVX OmzJj7Pm1GpF1CtAOp2tzponbCaMquyaCq598cUcKpX2JEORb5jqHkbQYt24hWNQ6Jg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796495970; h=Received:DKIM-Signature:From:Subject:Date:Message-Id:MIME-Version: Content-Type:Content-Transfer-Encoding:X-B4-Tracking:X-Change-ID:To: Cc:X-Mailer:X-Developer-Signature:X-Developer-Key; bh=lgln1cyVQK/Ogmg/YkUoDPigryeSAhfjjjD7mUhUZhU=; b=pXNJfZTzxnijWqhvwOzgXD81BIpWtXbhG86KqSjw/Mouw2M3BGFQM8C6STTvbgp6gGbl xwZ9/V0bRj11yHzwd9Y5sSSOXo9OBQFYIidkVJz8KJJ0vxtfjvpAndpciNy/Sh36brwMg skbLOcwUn66cRIPxT/k2MRFTOSUOFzHYLKLGEk+aYOKkfPimFf8hc6idU1vHDTBxua/uE /qAlAJMSokrRcPqQXDlYpC9ne+TqMI1i6gIwSPqQ7NlMYMRfr4Ere860m14fxqF9aukaf bJfmIlxn4g9j/9NjNMVjRm8KEAMWIG5tOMq/9uHaxYWkuzHnTmXhv+syGYZslHorHMQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="Zi4/cRS3"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C9373606A31F for ; Sat, 5 Dec 2026 18:39:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Zi4/cRS3 Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB00C1F00936; Sat, 5 Dec 2026 18:39:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796495970; bh=lgln1cyVQK/Ogmg/YkUoDPigryeSAhfjjjD7mUhUZhU=; h=From:Subject:Date:To:Cc; b=Zi4/cRS3pEsbgaPH6fFBXg9kGDDxej1lUx4BpOg52/leMWfwF+c/OoNb4GxJf5MPT EIIfzFF1q2ERaTsJSUsWLkzfRTf29j+32TaeGkqfsL2kne95O2TwRznKhNWmU1wCU4 eLC9Gl1fjb2hv257uTvgWZT3/XTR1pmXoQVWhWfDz/Q6GqwGb0JvpV8MFDbdEEijVo PJaRX5iU1V452Q8hWQqgEEMnsQOFVjwDz3fVvN+NK530RZO1phLWOvXIcgvOCqHVH9 GOokSTvDt7PKNI0L4zG48yEHiFTPu5LSiIwKDl6BwosmESdA+SK40SsBWASRfjx6VD b+kAxWY/gxRog== From: Chuck Lever Subject: [PATCH v2 0/5] SUNRPC: Fix a stale RPC GSS Reply match and two decode bugs Date: Sat, 05 Dec 2026 13:39:19 -0500 Message-Id: <20261205-gss-stale-reply-v2-0-c9e745261524@kernel.org> X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAAAAAAAC/3WOQRKCMAxFr8J0bZV2EMWV93BYpBAhii2TICPDc Hcprl2+n+T9zEqQCUVdklkxjiQU/Ap2l6iqBd+gpnplZVObG5tmuhHRMkCHmrHvJp0drYMsh6I ujFqvesY7fTbjrfyxvN0DqyFq4oYDQe0YfNXGKDA15A8vkAE5zluSIfC0vTSa6PnfPhqd6iK1C Hg6G1vB9YnssdsHblS5LMsXG7PPzeEAAAA= X-Change-ID: 20261204-gss-stale-reply-452ba46a9d91 To: Trond Myklebust , Anna Schumaker , Chuck Lever , Jeff Layton , NeilBrown , Olga Kornievskaia , Dai Ngo , Tom Talpey Cc: linux-nfs@vger.kernel.org, sashiko-bot X-Mailer: b4 0.17-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=3142; i=cel@kernel.org; h=from:subject:message-id; bh=V7LvdwkDFHcc9Uex78j2OT4/KEpCHC6WPWFrKr3xCaM=; b=owEBbQKS/ZANAwAKATNqszNvZn+XAcsmYgBrFFpZeu9xAHVtlkohFLvlrwM7lKZvhq1xlHX5Q PTJj6O5il2JAjMEAAEKAB0WIQQosuWwEobfJDzyPv4zarMzb2Z/lwUCaxRaWQAKCRAzarMzb2Z/ lwd5D/44A9izSPlo0neghEGIYtLoWikcFdLFth7DLGv0k79ZsyiqWXP/SGQUA1Aj4L5GnJAel8V uvhi7k0gmyMUf0BetTCsrFgsQZOIHPss/kLfigYnPVCEiWlV4JD4D3awzX5pTXldR4GXhK424S+ UINPvIj8jTBFe+dfqb8g+7k5rNgZQXIUqGqSAOmxWzPHnjOCTKYKe+60ESqMUNE3I5AyJhSJ7ee PjGP/L5S4a6N+JH6TLsBGVE177X2Mmv4xF0aB9tN3oyz0gU5G6kQX2kn0ebwzRpUcJkwsdfoA1B E7OG5YEVVETALaUX+s4jRIppH+Q5+hP9srSAvow01EV/mKTqvT+UPBQnnDLOfvVHyJk8D9WZxjM X2iBaTTAtj65gzv4d2APojWbgJG86uJm0y68cAhPrx5X+tTjPXmRtyfdOFzTFW3Pou0RNmTcVAc cVvwfA60K25/oJBgHFFWbAHXJxY21XBwiIRurchm/YIDig3UxxZiQncrjlSENhipuSGn+QZ0txx Tg8qSLn9n1QEPNide88U3UdyzpwZ1D/NfwCAekVDqQpdk/ovNia/7y6tiPBGWUS9l+FMnhr+lhG PsdVKDYtcTs4oKbrbnrrWuUreF5BL9kYsyPHbg27NJ+LeHznnCLjChKGXSpc0vLKrDYqC+/MN+K MWs4D6IDF4WGNlg== X-Developer-Key: i=cel@kernel.org; a=openpgp; fpr=28B2E5B01286DF243CF23EFE336AB3336F667F97 We've been chasing the GSS sequence number window under-run bug for many years. One of the side effects of that issue is frequent transport disconnects. Concurrent with those disconnects, I saw a number of EIO failures on client workloads that I couldn't explain. Those RPC tasks should be successful since the request executed on the server, and the Reply is still valid even though its connection is gone. After a disconnect, call_encode() assigns a waiting request a new GSS sequence number, but the Reply to the earlier encoding can still arrive. gss_validate() tries every cached sequence number against the reply verifier, as RFC 2203 Section 5.3.3.1 expects, and accepts a match against an older entry. gss_unwrap_resp_integ() and gss_unwrap_resp_priv() then compare the Reply body against only the newest cached sequence number, so a Reply that matched on an older entry is rejected and the caller gets EIO for a request the server already executed. Accepting a Reply body that matches an older entry is safe only if every cached sequence number belongs to the current GSS context. Currently a credential renewal leaves the old context's numbers in the cache, so renewal has to empty the cache before the body check changes. Auditing gss_unwrap_resp_integ() for the EIO fix turned up two further bugs in the same function. The checksum length it reads is bounded only by the space left in the receive buffer, so a forged length near the end of that buffer reaches kmalloc() with no upper bound. Once the checksum verifies, the function also never truncates the xdr_stream to the end of databody_integ, so the upper-layer decoder can read bytes the checksum does not cover. v1 was tested on 7.4-rc5 against an NFS server, vers=3 and vers=4.2, sec=krb5/krb5i/krb5p, over TCP and RDMA: READ, READDIR, READLINK, and NFSv3 GETACL data matched the server's across a range of sizes, with no unwrap, MIC, or XDR overflow trace events. A 60-second run of concurrent chmod(2) calls against a server dropping connections (via fail_sunrpc) completed with no EIO, during which thousands of replies verified against an older cached sequence number. Forged Reply content was not tested. v2 adds patch 2, which has been build-tested only. --- Changes in v2: - New patch 2: discard cached seqnos on cred renewal (sashiko-bot). - Link to v1: https://patch.msgid.link/20261204-gss-stale-reply-v1-0-902eae7812ca@kernel.org --- Chuck Lever (5): SUNRPC: Fix integer overflow in gss_unwrap_resp_integ() bounds check SUNRPC: Discard cached GSS sequence numbers on credential renewal SUNRPC: Check a GSS reply body against the verifier's sequence number SUNRPC: Limit the size of a GSS reply checksum SUNRPC: Stop krb5i reply decoding at the end of databody_integ include/linux/sunrpc/xprt.h | 1 + net/sunrpc/auth_gss/auth_gss.c | 26 +++++++++++++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) --- base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244 change-id: 20261204-gss-stale-reply-452ba46a9d91 Best regards, -- Chuck Lever