Thread View: linux.kernel.netdev
1 messages
1 total messages
Started by Bilal Hashim
Sat, 28 Nov 2026 14:03
[PATCH net v2] rxrpc: rxgk: round up appdata and authx lengths in rxgk_construct_response()
Author: Bilal Hashim
Date: Sat, 28 Nov 2026 14:03
Date: Sat, 28 Nov 2026 14:03
53 lines
10839 bytes
10839 bytes
In rxgk_construct_response(), `auth_len` is computed using `appdata->len`
instead of `xdr_round_up(appdata->len)`, while
rxgk_construct_authenticator() pads `appdata` to
`xdr_round_up(appdata->len)` bytes and returns
`sizeof(a) + xdr_round_up(appdata->len) + sizeof(b)`.
Userspace can supply an unaligned `RXRPC_RESP_RXGK_APPDATA` control
message via sendmsg() -> rxgk_sendmsg_respond_to_challenge(), which
copies `cmsg->cmsg_len - sizeof(struct cmsghdr)` into `appdata.len`
without checking 4-byte alignment. When `appdata->len` is not a multiple
of 4, the allocated scatterlist length (`sg_len`) is up to 3 bytes too
short, causing the profile encryption routine (krb5_aead_encrypt() or
rfc8009_encrypt()) to hit `WARN_ON(cksum_offset + krb5->cksum_len >
sg_len)` and return -EFAULT, preventing the RESPONSE packet from being
sent (and panicking systems with panic_on_warn).
As defensive hardening, also wrap `authx_len` in `xdr_round_up()` when
computing the total `len` to match the subsequent `rxgk_pad_out()` call,
even though all currently supported enctypes already produce a 4-byte
aligned `authx_len`.
Found by manual code inspection (not reproduced at runtime; verified via
call-chain analysis from sendmsg() -> rxgk_sendmsg_respond_to_challenge()
-> rxgk_construct_response() -> crypto_krb5_encrypt()).
Fixes: 9d1d2b59341f ("rxrpc: rxgk: Implement the yfs-rxgk security class (GSSAPI)")
Cc: stable@vger.kernel.org
Signed-off-by: Bilal Hashim <AeeSec@126.com>
---
Changes in v2:
- Add Fixes: tag and Cc: stable@vger.kernel.org.
- Clarify the exact WARN_ON() site (krb5_aead_encrypt() /
rfc8009_encrypt()), describe the `xdr_round_up(authx_len)` hunk as
defensive hardening, and note how the issue was discovered.
---
--- a/net/rxrpc/rxgk.c
+++ b/net/rxrpc/rxgk.c
@@ -936,11 +936,12 @@ static int rxgk_construct_response(struct rxrpc_connection *conn,
if (IS_ERR(gk))
return PTR_ERR(gk);
- auth_len = 20 + (4 + appdata->len) + 12 + (1 + 4) * 4;
+ auth_len = 20 + (4 + xdr_round_up(appdata->len)) + 12 + (1 + 4) * 4;
authx_len = crypto_krb5_how_much_buffer(gk->krb5, KRB5_ENCRYPT_MODE,
auth_len, &auth_offset);
len = sizeof(struct rxrpc_wire_header) +
- 8 + (4 + xdr_round_up(gk->key->ticket.len)) + (4 + authx_len);
+ 8 + (4 + xdr_round_up(gk->key->ticket.len)) +
+ (4 + xdr_round_up(authx_len));
response = alloc_skb_with_frags(0, len, 0, &ret, GFP_NOFS);
if (!response)
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads