From: Simon Horman <horms@kernel.org>
To: Piyus Kedia <piyus@iiitd.ac.in>
Cc: David Howells <dhowells@redhat.com>,
Marc Dionne <marc.dionne@auristor.com>,
linux-afs@lists.infradead.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, kapil@presceralabs.ai
Subject: Re: [PATCH net] rxrpc: fix the test for a sequence number being in a Tx queue
Date: Fri, 4 Dec 2026 20:11:52 +0000 [thread overview]
Message-ID: <20261204201152.GG192805@horms.kernel.org> (raw)
In-Reply-To: <20261127032448.2631400-1-piyus@iiitd.ac.in>
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@presceralabs.ai>
> Signed-off-by: Piyus Kedia <piyus@iiitd.ac.in>
> ---
> 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@kernel.org>
prev parent reply other threads:[~2026-12-04 20:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 3:24 [PATCH net] rxrpc: fix the test for a sequence number being in a Tx queue Piyus Kedia
2026-12-04 20:11 ` Simon Horman [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261204201152.GG192805@horms.kernel.org \
--to=horms@kernel.org \
--cc=dhowells@redhat.com \
--cc=kapil@presceralabs.ai \
--cc=linux-afs@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marc.dionne@auristor.com \
--cc=netdev@vger.kernel.org \
--cc=piyus@iiitd.ac.in \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox