mirror of https://lore.kernel.org/lkml/
 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	[flat|nested] 2+ messages in thread

* Re: [PATCH net] rxrpc: Fix RxGK server to reject an expired ticket
  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
  0 siblings, 0 replies; 2+ messages in thread
From: netdev-bot+sashiko @ 2026-11-20 19:05 UTC (permalink / raw)
  To: astellman
  Cc: dhowells, marc.dionne, davem, edumazet, kuba, pabeni, horms,
	linux-afs, netdev, linux-kernel

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] rxrpc: rxgk_yfs_decode_ticket() misses negative and epoch-
  truncated expiries

--

> diff --git a/net/rxrpc/rxgk_app.c b/net/rxrpc/rxgk_app.c
> --- 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;
>

[Severity: Medium]
This check only works when the ticket's expirationtime turns into a
positive number of seconds in key->expiry. Two cases get past it.

First, if expirationtime is at least one second before 1970-01-01,
rxrpc_s64_to_time64() returns a negative value. In that case
rxrpc_preparse_xdr_yfs_rxgk() jumps to its expired label, so
key_instantiate_and_link() itself fails with -EKEYEXPIRED. That error
takes the existing "if (ret < 0) goto error_key" just above and never
reaches the new rxrpc_abort_conn() call.

Back in rxgk_extract_token(), the cant_get_token switch only handles
-ENOMEM, -EINVAL and -ENOPKG. -EKEYEXPIRED falls through to
temporary_error, so the RESPONSE is quietly ignored instead of the
connection being aborted with RXGK_EXPIRED. The connection is left
sitting in the challenging state as if the error were transient.

Second, a non-zero endtime within one second of the epoch, in either
direction, is truncated to 0 by rxrpc_s64_to_time64(). The "expiry <
0" test in rxrpc_preparse_xdr_yfs_rxgk() lets that through, so
key->expiry ends up as 0. key_validate() treats 0 as "never expires",
so this expired ticket is accepted.

Both cases need a ticket encrypted with the server key, so they are
edge cases. Still, the point of the patch is to reject expired
tickets.

Would it be better to also map -EKEYEXPIRED from
key_instantiate_and_link() to the RXGK_EXPIRED abort? That could be
done here or in the cant_get_token switch. Separately, a non-zero
endtime that truncates to 0 could be treated as expired in
rxrpc_preparse_xdr_yfs_rxgk(). Alternatively, the ticket's endtime
could be compared directly against the current time here rather than
going through key->expiry. Which approach do you prefer?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261119184541.26343-1-astellman%40stellman-greene.com

^ permalink raw reply	[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

all inboxes | Powered by JetHome®