From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796415117; b=f8GThrQKyfRf4I9ecXAxykuSXb97cV25pPgP6XpsXE5E6OlMzf/czSBRAk8G/MFrK/y5 E9pY0dpteb4ReeoaBWc7K650HTEycgZvCyqeg0sN0BiW7K076wq/7O3awsGqQ4b2qQreP 5cGu4y3Vj+3/hfdrpDDRNHB2nXD/YjVDnRfSs6ysxKeComjMjCkCfTWvFlURqdpEmMH9p 1s+2ELHYVieMpQyoN8ty1fkHcH5yOMq+BO++A9AeXk2S/1ErtIa8mlO/YEPQhUExK9sVd qISE+YzbK9QJ2j9mGmnvoDLMbDGHouz5V9f+zIpLvv+UenxX1LS6WlA6lGVoABBdkaw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796415117; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=X8JBRbZIM1QN41RUf+TkRjR5CDWxYclHtZx36x/49xY=; b=vmJAINOL6ZnCCbJsuAEsg+X70qXSOelQHPRZKboYTQfMcCKRtPmkTMZbR/lVLt5dUnLv l2dM5zNw5oU4fbGAhxirXFDW/CYH+jVvh+aRBp2Z+7Vbix4EUxinB/+UBz8DQiceHhB7M 1PkTr2bGjjIslbdZBh3Ix8uxQkj4dZaKcUZtO6MfeKxl2q/troaDFp2QC2Zbz7FyEHHYU JKoUHn5T5FO2FnWq3u3Sn0M5uFfSKrCOnFzBKacTPKbA4LzR0MadLXdW7J6R3xEcnpS9L mXhh6GGDpmEOx9+xjUGF+ppQufSrsiFpPnZ6d7opeoqlrVkYT3+aX4B3eAtadGeGSaQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=nN4xrLiR; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A864606A334; Fri, 4 Dec 2026 20:11:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=nN4xrLiR Received: by smtp.kernel.org (Postfix) with ESMTPSA id 459CD1F0093B; Fri, 4 Dec 2026 20:11:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796415116; bh=X8JBRbZIM1QN41RUf+TkRjR5CDWxYclHtZx36x/49xY=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=nN4xrLiRXGpTZWUsRhhaJ8wWoYEGXy1zTeZAZouO84jrVc4YrrDShurbOKps4KC+z H4QHfnRpvqqzvN5QCP+08Xb3U3RNWi3VC5pSf0Y2STezhAh5wGD7ny4Ctjd5mbbOz9 mc+2zBXwGS2y5WP0m67SpAqe28Ch42Rnwtkdtaydllb4Iphk/kHWN5OGY96OMSN3xJ Dz0MG7eQgxq1gxh/w2U0G7Mc51SLtfTIxsaEQoPnfMNOmdCR2HaVraNJBudgJfKSNP c3dAFtmCygWSU+Xs1XtxHVNm9bBTJH2H2K8utkCurROLfrWRBX5NXcw79r1z06mFH5 rQmDaCobgazoA== Date: Fri, 4 Dec 2026 20:11:52 +0000 From: Simon Horman To: Piyus Kedia Cc: David Howells , Marc Dionne , 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 Message-ID: <20261204201152.GG192805@horms.kernel.org> References: <20261127032448.2631400-1-piyus@iiitd.ac.in> X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 > Signed-off-by: Piyus Kedia > --- > 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