Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 08 Apr 2026 22:42:41 +0000
From:      Vladimir Druzenko <vvd@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Cc:        Generic Rikka <rikka.goering@outlook.de>
Subject:   git: db6d744b6034 - main - net/ucx: Fix mm signal socket binding on FreeBSD
Message-ID:  <69d6d9e1.215e8.1b444ca0@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by vvd:

URL: https://cgit.FreeBSD.org/ports/commit/?id=db6d744b60348636c7a87c3c7fc181afd9b71994

commit db6d744b60348636c7a87c3c7fc181afd9b71994
Author:     Generic Rikka <rikka.goering@outlook.de>
AuthorDate: 2026-04-08 22:37:32 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2026-04-08 22:42:19 +0000

    net/ucx: Fix mm signal socket binding on FreeBSD
    
    Replace Linux-style UNIX domain socket autobind logic in the mm
    signaling path with explicit pathname-based binding on FreeBSD and
    remove the socket path during cleanup.
    
    This fixes FreeBSD runtime failures in the mm shared-memory signaling
    path.
    
    PR:             293867
    Sponsored by:   UNIS Labs
    MFH:            2026Q2
    
    : Update  =>
    
    Changelog:
    
    PR:
    Sponsored by:   UNIS Labs
---
 net/ucx/Makefile                                   |  1 +
 net/ucx/files/patch-src_uct_sm_mm_base_mm__iface.c | 87 ++++++++++++++++++++++
 2 files changed, 88 insertions(+)

diff --git a/net/ucx/Makefile b/net/ucx/Makefile
index f7cdf5e1385b..0df5bef86db1 100644
--- a/net/ucx/Makefile
+++ b/net/ucx/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=		ucx
 DISTVERSION=		1.20.0
+PORTREVISION=		1
 CATEGORIES=		net
 MASTER_SITES=		https://github.com/openucx/ucx/releases/download/v${DISTVERSION}/
 
diff --git a/net/ucx/files/patch-src_uct_sm_mm_base_mm__iface.c b/net/ucx/files/patch-src_uct_sm_mm_base_mm__iface.c
new file mode 100644
index 000000000000..000376248199
--- /dev/null
+++ b/net/ucx/files/patch-src_uct_sm_mm_base_mm__iface.c
@@ -0,0 +1,87 @@
+--- src/uct/sm/mm/base/mm_iface.c.orig	2026-03-14 22:02:10 UTC
++++ src/uct/sm/mm/base/mm_iface.c
+@@ -19,6 +19,9 @@
+ #include <ucs/async/async.h>
+ #include <ucs/sys/string.h>
+ #include <sys/poll.h>
++#include <sys/un.h>
++#include <stddef.h>
++#include <unistd.h>
+ 
+ 
+ /* Maximal number of events to clear from the signaling pipe in single call */
+@@ -681,6 +684,10 @@ static ucs_status_t uct_mm_iface_create_signal_fd(uct_
+     ucs_status_t status;
+     socklen_t addrlen;
+     struct sockaddr_un bind_addr;
++#if defined(__FreeBSD__)
++    const char *tmpdir;
++    int path_len;
++#endif
+     int ret;
+ 
+     /* Create a UNIX domain socket to send and receive wakeup signal from remote processes */
+@@ -700,10 +707,33 @@ static ucs_status_t uct_mm_iface_create_signal_fd(uct_
+     /* Bind the signal socket to automatic address */
+     bind_addr.sun_family = AF_UNIX;
+     memset(bind_addr.sun_path, 0, sizeof(bind_addr.sun_path));
++#if defined(__FreeBSD__)
++    tmpdir = ucs_get_tmpdir();
++    path_len = snprintf(bind_addr.sun_path, sizeof(bind_addr.sun_path),
++                        "%s/ucx_mm.%ld.%p",
++                        tmpdir, (long)getpid(), (void*)iface);
++    if ((path_len < 0) || ((size_t)path_len >= sizeof(bind_addr.sun_path))) {
++        ucs_error("Failed to generate unix domain socket path");
++        status = UCS_ERR_IO_ERROR;
++        goto err_close;
++    }
++
++    unlink(bind_addr.sun_path);
++
++    addrlen = offsetof(struct sockaddr_un, sun_path) + path_len + 1;
++    ret = bind(iface->signal_fd, (struct sockaddr*)&bind_addr, addrlen);
++#else
++    /* Linux autobind behavior */
+     ret = bind(iface->signal_fd, (struct sockaddr*)&bind_addr, sizeof(sa_family_t));
++#endif
+     if (ret < 0) {
+         ucs_error("Failed to auto-bind unix domain socket: %m");
+         status = UCS_ERR_IO_ERROR;
++#if defined(__FreeBSD__)
++        if (bind_addr.sun_path[0] != '\0') {
++            unlink(bind_addr.sun_path);
++        }
++#endif
+         goto err_close;
+     }
+ 
+@@ -718,6 +748,11 @@ static ucs_status_t uct_mm_iface_create_signal_fd(uct_
+     if (ret < 0) {
+         ucs_error("Failed to retrieve unix domain socket address: %m");
+         status = UCS_ERR_IO_ERROR;
++#if defined(__FreeBSD__)
++        if (bind_addr.sun_path[0] != '\0') {
++            unlink(bind_addr.sun_path);
++        }
++#endif
+         goto err_close;
+     }
+ 
+@@ -904,6 +939,17 @@ static UCS_CLASS_CLEANUP_FUNC(uct_mm_iface_t)
+ 
+     ucs_mpool_put(self->last_recv_desc);
+     ucs_mpool_cleanup(&self->recv_desc_mp, 1);
++
++#if defined(__FreeBSD__)
++    {
++        const struct sockaddr_un *sun =
++            (const struct sockaddr_un *)ucs_unaligned_ptr(&self->recv_fifo_ctl->signal_sockaddr);
++        if ((self->recv_fifo_ctl->signal_addrlen > offsetof(struct sockaddr_un, sun_path)) &&
++            (sun->sun_path[0] != '\0')) {
++            unlink(sun->sun_path);
++        }
++    }
++#endif
+     close(self->signal_fd);
+     uct_iface_mem_free(&self->recv_fifo_mem);
+     ucs_arbiter_cleanup(&self->arbiter);


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69d6d9e1.215e8.1b444ca0>