From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=P0LWyt5x; dkim-atps=neutral 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 87DCA5A0279 for ; Wed, 10 Sep 2025 09:46:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757490400; 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; bh=+NZVUcDNf/YubS3dAGkyJ+FS/GU3KGZYyoeKf9Yipvg=; b=P0LWyt5xDOCASuPgwA/eDfd8bRimZ62QhlB7ilV3cbDMQ09hswOshVe7KYcUpRJITxCFrf 5WG+LiDYoKqATbM7ADOuqKFm5a1/tVybsSQe+zeyHlmbeGkOQXt3MT7ieRf5lvXTrdJh2f xZnvfZ+XEjX0wI6h509j04CWJBZKmYQ= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-459-ycjumQkQOheqfyZFLKD2HQ-1; Wed, 10 Sep 2025 03:46:39 -0400 X-MC-Unique: ycjumQkQOheqfyZFLKD2HQ-1 X-Mimecast-MFC-AGG-ID: ycjumQkQOheqfyZFLKD2HQ_1757490398 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 178C21956048; Wed, 10 Sep 2025 07:46:38 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.72.112.95]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A83A219560AB; Wed, 10 Sep 2025 07:46:34 +0000 (UTC) From: Yumei Huang To: passt-dev@passt.top Subject: [PATCH] tcp: Add flags frames to payload frames arrays Date: Wed, 10 Sep 2025 15:46:30 +0800 Message-ID: <20250910074630.20879-1-yuhuang@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: H1iX4FQXZUdr2EvloMnBYTQigGVcNsQ2HqqOxMPURGo_1757490398 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: XK5OAJS3D5SIF6DHVA5H3SUAPIBORYVY X-Message-ID-Hash: XK5OAJS3D5SIF6DHVA5H3SUAPIBORYVY X-MailFrom: yuhuang@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: sbrivio@redhat.com, dgibson@redhat.com, yuhuang@redhat.com, v@njh.eu, boleyn.su@gmail.com 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: There is an issue reported by Volker Diels-Grabsch and Boleyn Su. A segmentation fault occurs when executing the following command: (sleep 0.1; ssh -p 22000 127.0.0.1) & passt -f -t 22000:22 It's caused by commit 78da088f7bab ("tcp: unify payload and flags l2 frames array"). Fix it by adding flags frames to payload frames arrays. Signed-off-by: Yumei Huang --- tcp_buf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tcp_buf.c b/tcp_buf.c index bc898de..d351c20 100644 --- a/tcp_buf.c +++ b/tcp_buf.c @@ -209,13 +209,14 @@ int tcp_buf_send_flag(const struct ctx *c, struct tcp_tap_conn *conn, int flags) if (ret <= 0) return ret; - tcp_payload_used++; + tcp_frame_conns[tcp_payload_used++] = conn; l4len = optlen + sizeof(struct tcphdr); iov[TCP_IOV_PAYLOAD].iov_len = l4len; tcp_l2_buf_fill_headers(conn, iov, NULL, seq, false); if (flags & DUP_ACK) { struct iovec *dup_iov = tcp_l2_iov[tcp_payload_used++]; + tcp_frame_conns[tcp_payload_used - 1] = conn; memcpy(dup_iov[TCP_IOV_TAP].iov_base, iov[TCP_IOV_TAP].iov_base, iov[TCP_IOV_TAP].iov_len); -- 2.47.0