From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=fail (p=quarantine dis=none) header.from=redhat.com Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTPS id 1D0E95A026E for ; Tue, 24 Nov 2026 13:14:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1795522489; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CJE4ETU4pKlZsBYcSwy+Bx2Ykew/6VAlPqGprCY4L8U=; b=Mpt6VlKYSl+EVr/mA+1U+TQCOmh2R54hJSZ1fyTaGjiz/QyU083Hwiexf9Td19R93bXpaG v8COGopIod5VLWW/pRzylAr88tqhl5xfEyeq6uPbU73bYIq+eX0Oo5L5tq75GwCtbBN74l fiFJbev5wrnDm6Bat7+ToIImN6ZB9sY= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-685-YKRODHW0Pb2FULjSlmzJNw-1; Tue, 24 Nov 2026 12:14:47 +0000 X-MC-Unique: YKRODHW0Pb2FULjSlmzJNw-1 X-Mimecast-MFC-AGG-ID: YKRODHW0Pb2FULjSlmzJNw_1795522486 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-48e0461e040so3482052f8f.0 for ; Tue, 24 Nov 2026 04:14:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795522486; x=1796127286; h=date:content-transfer-encoding:content-type:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=CJE4ETU4pKlZsBYcSwy+Bx2Ykew/6VAlPqGprCY4L8U=; b=nNhMY7jyt4MvYHngj2xqSEWRGAl1x+uuRk0GNZjw3ou0lIqLbh2v6xxzx9nA8ElouH g/P1a1fQnuBdPGvatCSvk0FhyOX0o0SHIJ7HVBTXATKty/zWOdZDGc7ma9LC6G/hd4as 8QqcDapXcahi+xhYxgbDgnB1rTea+i9vev+/so+zxEiVDgbwHCaqYqEjui9604SbE4iB hhJ8jbjkCQgA8Mbpn0x4otK99p6GG8wYBNfcx2XrI8+JXHwmKwz4k0wZnhLeDjckuY3+ En8ly+VK14ufqp3Szg+gm/UgtXTnn8rn0nwhTWvp7LjXfDrToLQZIJktZ53oDlKrGIQf WBPw== X-Gm-Message-State: APuU4Z89SZGkZEA0BSSFAwIHrOE/iH5oN197MNcmE9RQAxcp0M1w8SFb wy6T5aOP/lxiQRlAvTZZ/wNvr3naEDccPAwPvB699gVmSf0anaqEyWzqT2mXJAJ7qH0VPklHhW0 OtTGzouoq55eiKHqX2EC1O1H/nJv0QAi7xGmJaVICITecQzzhgv14Lg== X-Gm-Gg: AZFdTZeStYQWvI6de5RldbENw+tkRGQrqLRBtxvRyQ4Rgp01QnUEbvAzI5yq/uSmQmD 8B1DUCWfv0fEH+naFNqpPzSr52aozAI8n8O5vB/yXVQDgyyzEXZNl4gKjouAsZBojO7DD2qTQbG fk6xuR8q9AnetOJTqVwxs1MD7QghgJdYZZZvK2a25T4xRQpITHoUB4oQffux9L7oczG/og9H4+f MPyAc1jXGl1lvOspoymbJ5yGRKlvUNcvHCqNR9in2yTEA1fzoHsgODjMxecikhLB353p7FBgDLQ 9AlsjYCc5IZwAaFcLgAE6gaFloH0zybsyyr3YFuocgSMcX5TdVz8METsqqxu6K1ghTIlP1Ndj2N 3T95zmUif4UiUVoept1ApzhhXo8XkGxbi5HJKKCBblDM+JjzuApobt7r9OCnxLFj6l5I= X-Received: by 2002:a05:6000:41d2:b0:48b:1296:52ec with SMTP id ffacd0b85a97d-4abb0c5d65amr27409060f8f.18.1795522485670; Tue, 24 Nov 2026 04:14:45 -0800 (PST) X-Received: by 2002:a05:6000:41d2:b0:48b:1296:52ec with SMTP id ffacd0b85a97d-4abb0c5d65amr27409007f8f.18.1795522485070; Tue, 24 Nov 2026 04:14:45 -0800 (PST) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [2a10:fc81:a806:d6a9::1]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4ab6b205443sm29096702f8f.39.2026.11.24.04.14.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Nov 2026 04:14:44 -0800 (PST) From: Stefano Brivio To: Jason Chu Subject: Re: [PATCH] tcp: Keep window from tap below MAX_WINDOW Message-ID: <20261124131443.4f55445e@elisabeth> In-Reply-To: <20261123211602.3188010-1-jaschu@janestreet.com> References: <20261123211602.3188010-1-jaschu@janestreet.com> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.49; x86_64-pc-linux-gnu) MIME-Version: 1.0 Date: Tue, 24 Nov 2026 13:14:43 +0100 (CET) X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: dEKPERlvEFtA_HkgNZK3NhbVeRQ6ZvLm0Ovk9pmOnD8_1795522486 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: FBFWXQJDIXH42OQLW3WNCZHTIXU6JT5Y X-Message-ID-Hash: FBFWXQJDIXH42OQLW3WNCZHTIXU6JT5Y X-MailFrom: sbrivio@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top, David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Mon, 23 Nov 2026 16:16:00 -0500 Jason Chu wrote: > In tcp_internal.h, SEQ_GE(a, b) checks > (uint32_t)(a) - (uint32_t)(b) < MAX_WINDOW, so a sequence number > exactly MAX_WINDOW (16 MiB) ahead is treated as out of range. > > tcp_tap_window_update() clamps the advertised window from tap to > MAX_WINDOW inclusive, and pasta sends up to that full window. If the > peer negotiates a window scale above MAX_WS (9 to 14) and advertises > at least 16 MiB, pasta can put exactly MAX_WINDOW bytes in flight. > When the peer acknowledges all of them in one ACK, tcp_data_from_tap() > fails SEQ_GE(ack_seq, conn->seq_ack_from_tap) and ignores the ACK. > pasta then rewinds on each ACK timeout and retransmits the same 16 MiB, > which the peer drops as duplicate data while repeating the same ACK, > so the connection stalls. > > We hit this on Linux with a raised net.ipv4.tcp_rmem maximum (and it > also reproduces via SO_RCVBUF) when the receiver pauses while more > than 16 MiB arrives. In that case the kernel only sends a delayed ACK, > and pasta delivers all 16 MiB before the delayed ACK timer fires. > With a 6 MiB tcp_rmem maximum, the default on older kernels, the peer > uses a window scale of 7 and the window never reaches 16 MiB. Current > kernels default to up to 32 MiB, which we haven't tested. > > Clamp the window in tcp_tap_window_update() to MAX_WINDOW - 1 instead. > For window scales 9 to 14, the right shift rounds the stored window > down by one scale unit, keeping every valid ACK within SEQ_GE() range. > Window scales up to MAX_WS cannot represent MAX_WINDOW anyway. > > Assisted-by: Claude:claude-fable-5-2 > Signed-off-by: Jason Chu Wow, crazy that this can actually happen, I couldn't imagine. On the other hand, if the receiver pauses for long enough, that might obviously becomes the case. Thanks for the report and for the fix, applied. Welcome to the git log! -- Stefano