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=1796495972; b=3DI4E7N2UKBAbdfP7gov1eBPqjk3X2m6PaK7Hh2dfqA3Lluvw35xbSItHxuBVhj8d/7D 0Q+AkBnLFbo41MxCLRcVMuJzla6/150oodrK1ZOAw26yl0ejE3gfshBaNoyCU6Hz8Rrkv eifWatGSDwCIJGJ9emi8tSmnudH9h8WcOQM8d3FJMFN6fcZTL1Vb8buJ616FNk5XSGC9/ teIV3QPthelH5cgY0ImSwE4eBI7GrV4nqh79Aw/MyV8pVOj1N798vSNcwUZmJmEE1uhmk SCTxWEe3Y8Xe7bsVC5BwCul9VvAdKcZtIiCD5qoxbl/CrzQ4ahzGB+w2g3KzimlAtgQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796495972; h=Received:DKIM-Signature:From:Date:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc: X-Mailer:X-Developer-Signature:X-Developer-Key; bh=s7uFOjauInODonRvY5KKfqaq+LNOcr+G02qhPGk2Y2c=; b=21kWIxhMziUddIgD1LG3M8Ze3Kfj8HpmwFd3oRIYrXdiZ4v+QJSUnTkt+SoTXC4yaIS2 dLy5euw6wHNqwhr8FcJqtLKIUmHiBP9lGMwF/GDoTOL3Ej5GWOYKqyvmq0ys7C0juPtEu Te7yOtifRiuHAwqKqp7E130QAFgHxrn2vz1/DzqdHiHrapQpHH/xSBG70gIzffD12PxMs nDUzwdrYN4/vUve3vrFQaz06MT4jlpREyiIKcU+nFTiVonLosFcjoTFH2QMBhjJMWOk4N +vKce+599xy0rOBjf9XO3QO2VcOg0IH/mE3Kw8VtydrpZGq7WYSA4k3aDo+iin/cNqg== 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=GDvsTYj2; 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 73B2D606A333 for ; Sat, 5 Dec 2026 18:39:32 +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=GDvsTYj2 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88F1F1F00A12; Sat, 5 Dec 2026 18:39:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796495972; bh=s7uFOjauInODonRvY5KKfqaq+LNOcr+G02qhPGk2Y2c=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=GDvsTYj2wxy/vb0hwdj4t+27J+AuEDPYoMqMpTSMHYRIziQIxpkOkq/QeQa7tMrB9 rcdPt7SQk0/hQomyM+dphaLWoPyaU91h9BUZD3TYP/osLmfnahvfbNyE4aYfliWVaZ /v2ByJ6JEqJTaIFy2OfJGS7ARc9tTvyVPCKTXWO8OxLkjvnG8Zc62/zYA4f0Gtehe0 88bN6P439VlgDpTKXw3m88Lve7y3dsuYYwqFM0GCTXwlUi93+oZQ1EgvXt+SmbL4sr 8XrVkqEmgLOocHCDUryt2sCmiJsFxfGfPZmy+PV/HvDQPLi/aW2bMdNEk3JyJV7pnw lNKgMNfx7Po0Q== From: Chuck Lever Date: Sat, 05 Dec 2026 13:39:21 -0500 Subject: [PATCH v2 2/5] SUNRPC: Discard cached GSS sequence numbers on credential renewal 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 Message-Id: <20261205-gss-stale-reply-v2-2-c9e745261524@kernel.org> References: <20261205-gss-stale-reply-v2-0-c9e745261524@kernel.org> In-Reply-To: <20261205-gss-stale-reply-v2-0-c9e745261524@kernel.org> 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=2061; i=cel@kernel.org; h=from:subject:message-id; bh=J5PqhMvclSnkpfNSyGSnsP72vZq7g90ID8S10VaLeOU=; b=owEBbQKS/ZANAwAKATNqszNvZn+XAcsmYgBrFFpgNMJiJzxEodjXMETY0ccKGgGDJ4AsWTsVQ AcHB11JSE2JAjMEAAEKAB0WIQQosuWwEobfJDzyPv4zarMzb2Z/lwUCaxRaYAAKCRAzarMzb2Z/ lyG7D/sE4bkbSElRJajidnrPjRZ/n6KASM6Isbz/J2T13oF6efIhlrKWa7+g6WXBYR2TQsaEaBu FOrIEKOm0uFFM4lrhpRwiC2q0Kal55crGup7pkurafUcrOLnaAPzdFJDlWvcx4CNLWcrCNLorN3 2I6V34z0jzEpbzLhijFuMDsPRBeoz9Qldy2Z3+4Ci9Fj9AD4ahY8UYpeRau7VR2y2WypH7aFe+C 81bgOiwkeuOrPXHp3aTip/PD3pV3rcfc+QOIw1UqsANreGc9d8zLpMeyGIdh2Obwrv4o+JwAg55 UU7NVRzItKyyzblitAyF8u3neuI4owVQNTbW6+ph+QxdTm50zTF/kJgM9yT1M7csZptgd3+bfaf gIFMUMy4fjS+aficngfgqO5bq4vgA8dts9P+cTEk7UdVa+2d5iNdaUA2AfvkzSJK81nO4mX/WMV YbcnittlAEO6oS7Kivbn87qGK1ufc5edrvn5JrgtflSOrGPtXQD69pVz4dVSG77xxwXjbCXRkCB jCrJudJb/vK3zHRDFjjW4U1OPAGOuDoskh7V8Pdolzr97lq0H64alkU97g1kQw04teU4QH4wfQ5 p9DymUcLLlHJbtiuaKdI+hxgE8o3meaPe3b9KhzcYCFTd0uZx27ikG36OqFkBC/c64bgvZo2LXk lMBclNo0oHc/8mw== X-Developer-Key: i=cel@kernel.org; a=openpgp; fpr=28B2E5B01286DF243CF23EFE336AB3336F667F97 When gss_marshal() finds that a GSS context has expired, call_refresh() and gss_renew_cred() give the same rpc_rqst a new credential. rq_seqnos[] still holds sequence numbers from the old context. The new context starts numbering again at 1, so a stale entry can equal the sequence number of a different request sent on the new context. The reply verifier covers the sequence number but not the XID. gss_validate() therefore accepts the verifier from the other request's reply if that reply arrives with the renewed request's XID. A server that echoes XIDs correctly does not send such a reply. With sec=krb5, SUNRPC then decodes the body as the result of the renewed request. RFC 2203 Section 5.3.3.1 permits a client to match a reply verifier against cached sequence numbers. A match identifies an earlier encoding of a request only if every cached entry comes from the current context. Accepting the body of a late krb5i or krb5p reply, which the unwrap functions currently reject, depends on the same condition. Empty rq_seqnos[] when replacing the credential. A reply to an encoding under the old context cannot verify with the new context's key, so the old entries are of no further use. Reported-by: sashiko-bot Closes: https://sashiko.dev/#/patchset/20261204-gss-stale-reply-v1-0-902eae7812ca@kernel.org?part=2 Fixes: 08d6ee6d8a10 ("sunrpc: implement rfc2203 rpcsec_gss seqnum cache") Signed-off-by: Chuck Lever --- net/sunrpc/auth_gss/auth_gss.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index 50b8503d3a12..6919b2865cfc 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c @@ -1620,6 +1620,8 @@ static int gss_renew_cred(struct rpc_task *task) return PTR_ERR(new); task->tk_rqstp->rq_cred = new; + /* Cached sequence numbers belong to the old GSS context */ + task->tk_rqstp->rq_seqno_count = 0; put_rpccred(oldcred); return 0; } -- 2.56.0