Re: [PATCH net] rxrpc: fix the test for a sequence number being in a Tx queue

From: Simon Horman

Date: Fri Dec 04 2026 - 15:12:06 EST


On Fri, Nov 27, 2026 at 08:54:48AM +0530, Piyus Kedia wrote:
> rxrpc_seq_in_txq() masks the sequence number down to the queue size and
> compares the result with tq->qbase, but qbase is a whole sequence number,
> not an index. A new queue is only allocated when send_top + 1 is a
> multiple of RXRPC_NR_TXQUEUE, so qbase is 0, 64, 128 and so on. That makes
> the test wrong in both directions: for the first queue it is true for every
> sequence that is a multiple of 64, and for every later queue it can never
> be true at all.
>
> rxrpc_input_soft_ack_tq() uses it to decide whether the tail loss probe is
> in the queue it is looking at:
>
> if (call->tlp_serial &&
> rxrpc_seq_in_txq(tq, call->tlp_seq) &&
> test_bit(call->tlp_seq - tq->qbase, &new_acks))
>
> new_acks is a single unsigned long, so when the probe is at sequence 64 and
> qbase is 0 the test_bit() reads the word past it. A peer that soft-acks
> without ever advancing firstPacket keeps the first queue alive while the
> call goes past sequence 64, and KASAN then reports:
>
> BUG: KASAN: stack-out-of-bounds in rxrpc_input_soft_ack_tq+0x467/0x530
> Read of size 8 at addr ffffc9001363f848 by task krxrpcio/0/9662
> rxrpc_input_soft_ack_tq+0x467/0x530 net/rxrpc/input.c:959
> rxrpc_input_soft_acks+0x2f0/0x4d0 net/rxrpc/input.c:1014
> rxrpc_input_ack+0x6c5/0x910 net/rxrpc/input.c:1199
> rxrpc_input_call_packet+0x1db/0x250 net/rxrpc/input.c:1290
> rxrpc_input_call_event+0x16d/0xc30 net/rxrpc/call_event.c:338
> rxrpc_io_thread+0x534/0x860 net/rxrpc/io_thread.c:531
> The buggy address belongs to stack of task krxrpcio/0/9662
> and is located at offset 40 in frame:
> rxrpc_input_soft_ack_tq+0x0/0x530
> This frame has 1 object:
> [32, 40) 'new_acks'
>
> Compare the base of the queue instead of a masked sequence. The probe
> detection also starts working for queues other than the first.
>
> We found this with a syzkaller-based fuzzing harness driven by an AI tool.
>
> Fixes: 7c482665931b ("rxrpc: Implement RACK/TLP to deal with transmission stalls [RFC8985]")
> Signed-off-by: Kapil Vaswani <kapil@xxxxxxxxxxxxxxx>
> Signed-off-by: Piyus Kedia <piyus@xxxxxxxxxxx>
> ---
> Tested on 7.4.0-rc1 (63fe746a609a) with KASAN, same config and image before
> and after, with only net/rxrpc rebuilt between the two. The fault needs the
> tail loss probe to land on a multiple of 64, so the reproducer walks the
> transfer size until it does and the rxrpc_tlp_probe tracepoint says where it
> landed:
>
> before pq=0x40 (sequence 64) KASAN: stack-out-of-bounds
> after pq=0x40 no report

Reviewed-by: Simon Horman <horms@xxxxxxxxxx>