* [BUG] rxrpc: stack out-of-bounds read in rxrpc_input_soft_ack_tq()
@ 2026-11-27 3:24 Piyus Kedia
0 siblings, 0 replies; only message in thread
From: Piyus Kedia @ 2026-11-27 3:24 UTC (permalink / raw)
To: David Howells, Marc Dionne, linux-afs; +Cc: netdev, linux-kernel, kapil
Hi,
A peer can make rxrpc_input_soft_ack_tq() read past a local variable on the
I/O thread's stack. The read is 8 bytes and lands on whatever follows a
one-word bitmap.
The cause is rxrpc_seq_in_txq():
static inline bool rxrpc_seq_in_txq(const struct rxrpc_txqueue *tq,
rxrpc_seq_t seq)
{
return (seq & (RXRPC_NR_TXQUEUE - 1)) == tq->qbase;
}
It masks the sequence number down to the queue size and compares that with
tq->qbase, which is a whole sequence number rather than an index. A queue
is only allocated when send_top + 1 is a multiple of RXRPC_NR_TXQUEUE
(sendmsg.c), so qbase is 0, 64, 128 and so on. The test is therefore true
for the first queue whenever the sequence is a multiple of 64, and false
for every later queue no matter what.
The one caller is rxrpc_input_soft_ack_tq():
if (call->tlp_serial &&
rxrpc_seq_in_txq(tq, call->tlp_seq) &&
test_bit(call->tlp_seq - tq->qbase, &new_acks))
summary->tlp_probe_acked = true;
new_acks is a single unsigned long. With qbase 0 and tlp_seq 64 the offset
handed to test_bit() is 64, so it reads the word after new_acks. The
offset
is tlp_seq / 64 words, so it grows with how far the call has gone past the
first queue.
The first queue stays in the list as long as it is not fully hard-acked, so
a peer that soft-acks packets without ever advancing firstPacket keeps it
there while the call transmits past sequence 64. The tail loss probe then
sets tlp_seq to the last transmitted sequence, and the next ACK that
reaches
the first queue does the read. Only one bit of the value is used, so the
leak is narrow, but the read itself is out of bounds and the offset is not
fixed.
The test came in with the RACK/TLP work in 7c482665931b, which added both
the helper and its only caller, so this affects v6.14 and later. It is
still there in mainline today.
Reproduced on 7.4.0-rc1 (63fe746a609a) with KASAN on x86_64, and on 7.3.1.
The rxrpc_tlp_probe tracepoint confirms the condition - it fires with
pq=0x40, that is sequence 64:
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
kthread+0x26a/0x2c0 kernel/kthread.c:436
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'
A patch follows. It compares the base of the queue instead, which also
makes the probe detection work for queues other than the first - at present
it is dead code there. With it applied the same reproducer reaches
sequence 64 again and there is no report.
We found this with a syzkaller-based fuzzing harness driven by an AI tool.
The analysis above was checked by hand against the code.
Reproducer: not included here. Documentation/process/security-bugs.rst
says a finding made with AI assistance is treated as public, and the same
paragraph says not to post the reproducer publicly. It is a single C file,
tested, and available on request.
Thanks,
Piyus
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-27 3:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-27 3:24 [BUG] rxrpc: stack out-of-bounds read in rxrpc_input_soft_ack_tq() Piyus Kedia
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®