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=1796394679; b=A3ZstZlxaFxhRMAP44Tyv3rvqhc9cKt/JSNcDXKNt2pZXkyeAjqPvLvTp1LxVVd2a/xu l1g+mERHsfbtIricmgfPmdBeWDWTuIKdxjk101x6lZEBvFjtcDl9MV5wE4j+CV3TPJknw 6XXJ7qZIXP5mhqrDQcZINTaOTJs4b/dqpe6I1eIS62azpGanZ5qsCU7Am+SzthfHhnFRg 8wiGkXCbRfHh8yImi7BV1/5LDhmUKZaPI4zj0QxmkBpe0eB6IWyEJqoVSjCuK9izRjkt7 qxqjbHXz55d4hZ8zDWX030bLksU9BNeFR9YDc5xFxd2HZHEaTHLR2khuj00ZXApI1fQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796394679; 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=c/DNkyP/j7Ge8O5UTONIH5YAauM+76798Hq2Lj3HbFs=; b=0qw3i8SQwzbitDjpBffE6bUlH2mURn/39rH8dli1Hz5oAzKoHB9RKnPxln/8Flo+cmol SpJ9Lr/FGCprc05Ce31cfgtx4oSU7HPYkeR1MYG9woY+4q//wZ8M3/btFn+Q1onTR2owO nMBhDXr1l6HeZm3GMp+68u+HL89dN5LTrZtzMwJYI2c5QVQWDeQbh0DC1nh+Qlq2IE6Qr 9FAd+LW+zAnIr97oWvHRWZAHiSwuWTMIiiqgVaFUFKEUcL0U5mRWguRXGsKGA66ed5kum cKSbf9DXNnDYHWOxihUpGMKaBoJPphzFhLmf9JW6u/csWBt71S2ZwaCYJvr8ICHwE7Q== 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=c6OO4clX; 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 1B7D7606A322 for ; Fri, 4 Dec 2026 14:31:18 +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=c6OO4clX Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A9571F000C2; Fri, 4 Dec 2026 14:31:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796394678; bh=c/DNkyP/j7Ge8O5UTONIH5YAauM+76798Hq2Lj3HbFs=; h=From:Subject:Date:To:Cc; b=c6OO4clXsvbV+dwJi3rKN2B+K5Le3BWwfrgq23x+CXJZutknocC68vozbZ+Y4uP8l c5sxBK3wsajZg9U/3wq7aZZ41T5iVyj4LYsotcFHyyAkaL0J0ouh4Z3nMC3XgRiy3W W6qcKWmdWHcTnUTRdUbq7c8ovOTBnMLwK6AapH0DbvGEKF2mMEx5j4HwWxA61b2gby IYJJjfQLXq/gKqpkY4C2eldgttIC1JrzhkgPY0X7OOFlhAEBTH6rNK+h9dRRWO5PZh Fa/pZZSq+ItfeCQPfnRmUzAuGDWNTfn5OmCu9ErlXyOL/hTI7ZlruMYZWbLDXjJHUu CbzvDbg3anRiQ== From: Chuck Lever Subject: [PATCH 0/4] SUNRPC: Fix a stale RPC GSS Reply match and two decode bugs Date: Fri, 04 Dec 2026 09:31:04 -0500 Message-Id: <20261204-gss-stale-reply-v1-0-902eae7812ca@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/yWMQQ6CMBBFr0JmbSNtKglexbiYlhHGYCEz1WgId 7fV5fv5722gJEwK52YDoRcrL6mAPTQQJ0wjGR4Kg2tdZ13rzahqNONMRmidP8afXEDfYT/0Foq 1Ct34/Stern/WZ7hTzDVTHwGVTBBMcarTIjxyOj5QMwns+xeSA4qKkwAAAA== X-Change-ID: 20261204-gss-stale-reply-452ba46a9d91 To: Trond Myklebust , Anna Schumaker , Jeff Layton , NeilBrown , Olga Kornievskaia , Dai Ngo , Tom Talpey Cc: linux-nfs@vger.kernel.org, Chuck Lever X-Mailer: b4 0.17-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=2537; i=cel@kernel.org; h=from:subject:message-id; bh=rtW5FaoF1eFuvE8ZwMz4RyiKIcEUeEsyWveikSQ6K7I=; b=owEBbQKS/ZANAwAKATNqszNvZn+XAcsmYgBrEs6uyoyy/DeO5uEGux/vwwhpI7j82VKlNI8Te rvwPhI61q+JAjMEAAEKAB0WIQQosuWwEobfJDzyPv4zarMzb2Z/lwUCaxLOrgAKCRAzarMzb2Z/ l0/iD/9jmt/rR9YVolx7Lf3MTqzn/u2NTsHef0SvJDkDzSJH6sLZh7SEor3drQlbsVUHnSUO/9u qjKgE/BBRFZ122NZdQLn4CPjddBFO9OF8tixgMeUKM+29pHIhrq68JSD+to0xCEsSA2huMGyKuA 6dn3YgsFQ2LWWqiwufGqw5h1lgYbWeUPO0EX0hEU8vmXdKcS8uZmE0s9RNmCrAeYrY7uhXjmSex N+sWBZuMwchCeIoFt4nB29XLWnopDhA/Zb+nV07EAKUuYoJrMHCTHkWUmHFTduGV6+IwrkKX1li K82+CAcJ4Lf4PGXofNXyysm3JJ0jq6CXbAyZg+BBbGRpGecu0madYtHO2IdJ3vttCWR7vJ2Da8P NPKJuX/02Zd9+sUR1o45WU0iPTyv84YT+HWnFRKUDPUtJa4m8IXXSfo6FcxjhazIpR7f93XIYG8 tR8NYcyGp4XVqQ7UM7lLDL30ye6LlFVy3B5sx9cG42n0cjF22d1nZ3RXo2M9cLHI4hUspRKjTSN +MY7Gs1BcyxouKWyPqlUw0wz0CrxHM9H4m7Xjg2DkANNe2qMwE6jremux4roZsjfVs7SKyiIp+D njPa5Eo3u2o8AdeYTyDCBKHyWWt2Rz+bd52ybs258mpvbeAq1HYScWiEvfc5yDYra0nAVfsCumf FKs89E4fiy2BJ0Q== 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: these 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. Auditing gss_unwrap_resp_integ() for that 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. 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. --- Chuck Lever (4): SUNRPC: Fix integer overflow in gss_unwrap_resp_integ() bounds check 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 | 24 +++++++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) --- base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244 change-id: 20261204-gss-stale-reply-452ba46a9d91 Best regards, -- Chuck Lever