Article View: linux.kernel.netdev
Article #27120Re: [PATCH net] rxrpc: fix the test for a sequence number being in a Tx queue
From: Simon Horman
Date: Fri, 04 Dec 2026 20:11
Date: Fri, 04 Dec 2026 20:11
55 lines
10371 bytes
10371 bytes
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>
Technical Details
Message-ID:
<20261204201152.GG192805@horms.kernel.org>Path:
mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377609-linux-kernel-netdev=dewy.ruReferences:
<20261127032448.2631400-1-piyus@iiitd.ac.in>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377609-linux-kernel-netdev=dewy.ru From: horms@kernel.org (Simon Horman) Newsgroups: linux.kernel.netdev 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 Organization: Usenet Network Message-ID: <20261204201152.GG192805@horms.kernel.org> References: <20261127032448.2631400-1-piyus@iiitd.ac.in> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="2854243"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:ACjLlsLMlEkwVUZ5weHM4ZEpBVU= sha256:Z5B15ltQ1nXG9ReJV2B574xtBSnqXz7Vzlmx4ZFESIk= sha1:bWM9ADDOObC3qdGbtZefI3YZKmA= sha256:nhBAgj/sPXXMnUfnZX2F/YLM+My8mAXmCP6NV32Dvjo= Content-Disposition: inline List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 8A895117CD2; Fri, 4 Dec 2026 23:12:16 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.542 X-Spam-Status: No, score=-3.542 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.142, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id G6dRWrF4S-q3; Fri, 4 Dec 2026 23:12:13 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-377609-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 703F7117C0E; Fri, 4 Dec 2026 23:12:04 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 170EC3C406; Fri, 4 Dec 2026 20:11:59 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796415118; b=xFeExh79KKbVSfXvqJGRMw7AGAiVrA21bhfL9LhjoBoTZ3YbFJ6JSO5xhyzy/pejirYY 21KOVbErbPmyNqHVkXxTY+fvF8L6/cqX4R2XwFfQ36pWXGsCbIJcJFpQQe9FG4YayZwrh LLXlz7g6VGBXCbqEQ4AiAoRRYzx+O1wrXRld+63IOo7VQb/YMhaEAKLitnQm9dgJeF1ZB erRFPVmMVB5lLac5JPtc8S304Pzre0EuSowVyJHA+8tB0IHTzy49zEhpu/D8X+huER+d9 0ulp9Yx+0JfpjFgjgScCkl2QB/EA8J3K8LplYl/gU0uKbb2zABuKSYNLpuvPsgbVjUQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796415118; h=X-Original-To:Received:Received:DKIM-Signature:Date:From:To:Cc: Subject:Message-ID:References:X-Mailing-List:List-Id:List-Post: List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence: MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=X8JBRbZIM1QN41RUf+TkRjR5CDWxYclHtZx36x/49xY=; b=Su+p/m7BP5VMYUsdyhG2yrroCGBf3lQx/KxeApGGt7nQJ0AeSPGJD5kohIGTC7M8oBkb 1eIVd1btxij7/hWO3EBEO9NUxXizCue9Ukj0YTjj5VvRo9St31lfAFzvNeuZTZw6+X13U t75hkbwfRVY1xtF/YjLJNECs7ssweRU+eH0G3mU0oj6+VvEI+Ku0tJXqKzx0MAbfrHR1H Fw0efOeaZfxQd8LYM/9wTz1Blp+HoC/w1lfufewCYKE3pvvie1k+EwF9aYdxD5DBhrY4u 2kQ1xfTdzM9pCuDO6qoKZsRZJxEPF7JVB8pIvtcbAimPeboubY9qc76PHFxJ5pgv2lA== X-ARC-Authentication-Results: i=2; 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=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 092AF606A686; Fri, 4 Dec 2026 20:11:58 +0000 (UTC) X-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 X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-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== X-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== X-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 X-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) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 459CD1F0093B; Fri, 4 Dec 2026 20:11:55 +0000 (UTC) X-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== X-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 X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-In-Reply-To: <20261127032448.2631400-1-piyus@iiitd.ac.in>