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=CQjurFRO; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTPS id 5AD4C5A0271 for ; Wed, 07 May 2025 14:36:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1746621399; 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=G6DhEMKqjhwPFUixZogfQMbSYHuD3Si5aP87/YpWbWA=; b=CQjurFROK5RXw1T+y4sVJJ+579T1THE+x4wk8rg4LlM+viB/xnlYwsX+lJpEeWLntVsTQ1 GslMLo9iNYl3EbnyCIfI7/ySHvcim6GPsZz5LlKGS5KcPZLo2dp92MeZwlMcnvlKD55EG2 miUjlfhEUAhk/0hX6Jl879XLPnGApUA= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-680-fD2FjkJUMSKInwgA91vbag-1; Wed, 07 May 2025 08:36:37 -0400 X-MC-Unique: fD2FjkJUMSKInwgA91vbag-1 X-Mimecast-MFC-AGG-ID: fD2FjkJUMSKInwgA91vbag_1746621396 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A6226180035F for ; Wed, 7 May 2025 12:36:36 +0000 (UTC) Received: from lenovo-t14s.redhat.com (unknown [10.44.32.213]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 94F691953B80; Wed, 7 May 2025 12:36:35 +0000 (UTC) From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH] flow: fix podman issue #26073 Date: Wed, 7 May 2025 14:36:34 +0200 Message-ID: <20250507123634.673320-1-lvivier@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: KaTZ-vhOdeJ0XssLaGLvsfWZDugOUz8gbLSNgFErz70_1746621396 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: 6PAPRR44OPL7IE5OLGBUOI5IEK65D5FX X-Message-ID-Hash: 6PAPRR44OPL7IE5OLGBUOI5IEK65D5FX X-MailFrom: lvivier@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: Laurent Vivier 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: While running pasta, we trigger the following assert: ASSERTION FAILED in udp_at_sidx (udp_flow.c:35): flow->f.type == FLOW_UDP in udp_at_sidx() in the following path: 902 void udp_sock_handler(const struct ctx *c, union epoll_ref ref, 903 uint32_t events, const struct timespec *now) 904 { 905 struct udp_flow *uflow = udp_at_sidx(ref.flowside); The invalid sidx is comming from the epoll_ref provided by epoll_wait(). This assert follows the following error: Couldn't connect flow socket: Permission denied It appears that an error happens in udp_flow_sock() and the recently created fd is not removed from the epoll_ctl() pool: 71 static int udp_flow_sock(const struct ctx *c, 72 struct udp_flow *uflow, unsigned sidei) 73 { ... 82 s = flowside_sock_l4(c, EPOLL_TYPE_UDP, pif, side, fref.data); 83 if (s < 0) { 84 flow_dbg_perror(uflow, "Couldn't open flow specific socket"); 85 return s; 86 } 87 88 if (flowside_connect(c, s, pif, side) < 0) { 89 int rc = -errno; 90 flow_dbg_perror(uflow, "Couldn't connect flow socket"); 91 return rc; 92 } ... flowside_sock_l4() calls sock_l4_sa() that adds 's' to the epoll_ctl() pool. So to cleanly manage the error of flowside_connect() we need to remove 's' from the epoll_ctl() pool using epoll_del(). Link: https://github.com/containers/podman/issues/26073 Signed-off-by: Laurent Vivier --- udp_flow.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/udp_flow.c b/udp_flow.c index fea1cf3c7a41..b3a13b7993d5 100644 --- a/udp_flow.c +++ b/udp_flow.c @@ -87,6 +87,10 @@ static int udp_flow_sock(const struct ctx *c, if (flowside_connect(c, s, pif, side) < 0) { int rc = -errno; + + if (pif == PIF_HOST) + epoll_del(c, s); + flow_dbg_perror(uflow, "Couldn't connect flow socket"); return rc; } -- 2.49.0