Netdev List
 help / color / mirror / Atom feed
* [PATCH net] rxrpc: Fix RxGK server to reject an expired ticket
@ 2026-11-19 18:45 Andrew Stellman
  2026-11-20 19:05 ` netdev-bot+sashiko
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Stellman @ 2026-11-19 18:45 UTC (permalink / raw)
  To: David Howells, Marc Dionne
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, linux-afs, netdev, linux-kernel

rxgk_yfs_decode_ticket() decodes the ticket in a RESPONSE and builds a
key from it, with the key's expiry set from the ticket's expiration
time. Nothing checks that expiry before the connection is set up, so a
client holding a token whose ticket has expired can still open a
connection and have its calls delivered to the service. Section 6.3 of
draft-wilkinson-afs3-rxgk-afs-08 says servers must reject connections
secured with an expired token, and rxkad already rejects an expired
ticket in rxkad_decrypt_ticket().

Check the key with key_validate() after it is instantiated, and abort
the connection with RXGK_EXPIRED if the ticket has expired. A ticket
that expires while a connection is open is not handled here. As with
rxkad, the server keeps accepting calls on that connection but can't
send replies.

Reproduced on v7.4-rc3 under QEMU with the in-kernel rxperf server and a
small userspace client. The client's token has an end time in the
future, because the client won't use an expired token, but the ticket
inside it (encrypted with rxperf's test server key) expired 30 days ago.
Without the patch the connection is set up and rxperf reads the whole
request. Only its reply fails, with -EKEYEXPIRED. With the patch the
connection is aborted with RXGK_EXPIRED and no request data reaches
rxperf. A token with an unexpired ticket works either way. No other
kernel changes, debug code or error injection were used. There is no
rxrpc selftest.

The issue was found by Claude Opus 5.5 running Quality Playbook, an
LLM-driven code review tool:
https://github.com/andrewstellman/quality-playbook
The fix and this changelog were drafted with the same tool and reviewed
by me.

Fixes: 9d1d2b59341f ("rxrpc: rxgk: Implement the yfs-rxgk security class (GSSAPI)")
Signed-off-by: Andrew Stellman <astellman@stellman-greene.com>
---
A reproducer is available on request.

David, this takes enum rxrpc_abort_reason to 128 entries. Your pending
"rxrpc: Fix packet encryption error handling" adds one more, so with
both it has 129. In a small test, clang treats a __mode(byte) enum as
signed and warns that the 129th value wraps to -128. I can reuse an
existing reason instead if you prefer.

 include/trace/events/rxrpc.h | 1 +
 net/rxrpc/rxgk_app.c         | 7 +++++++
 2 files changed, 8 insertions(+)

diff --git a/include/trace/events/rxrpc.h b/include/trace/events/rxrpc.h
index 56dc9b614071..684034c67c69 100644
--- a/include/trace/events/rxrpc.h
+++ b/include/trace/events/rxrpc.h
@@ -97,6 +97,7 @@
 	EM(rxgk_abort_resp_short_yfs_key,	"rxgk-resp-short-yfs-key") \
 	EM(rxgk_abort_resp_short_yfs_tkt,	"rxgk-resp-short-yfs-tkt") \
 	EM(rxgk_abort_resp_tok_dec,		"rxgk-resp-tok-dec")	\
+	EM(rxgk_abort_resp_tok_expired,		"rxgk-resp-tok-expired") \
 	EM(rxgk_abort_resp_tok_internal_error,	"rxgk-resp-tok-int-err") \
 	EM(rxgk_abort_resp_tok_keyerr,		"rxgk-resp-tok-keyerr")	\
 	EM(rxgk_abort_resp_tok_nokey,		"rxgk-resp-tok-nokey")	\
diff --git a/net/rxrpc/rxgk_app.c b/net/rxrpc/rxgk_app.c
index 200a30064fae..34a3bdea531d 100644
--- a/net/rxrpc/rxgk_app.c
+++ b/net/rxrpc/rxgk_app.c
@@ -147,6 +147,13 @@ int rxgk_yfs_decode_ticket(struct rxrpc_connection *conn, struct sk_buff *skb,
 	if (ret < 0)
 		goto error_key;
 
+	ret = key_validate(key);
+	if (ret < 0) {
+		ret = rxrpc_abort_conn(conn, skb, RXGK_EXPIRED, ret,
+				       rxgk_abort_resp_tok_expired);
+		goto error_key;
+	}
+
 	token = key->payload.data[0];
 	token->no_leak_key = true;
 	*_key = key;

base-commit: 1e575bda30acc0bf01f799cee798d4a1c100d538
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-20 19:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-19 18:45 [PATCH net] rxrpc: Fix RxGK server to reject an expired ticket Andrew Stellman
2026-11-20 19:05 ` netdev-bot+sashiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox