git: 4f4b7701836b - main - net/ucx: Fix libucm early-init panic and resolve gtest suite failures
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 18 Jun 2026 16:14:32 UTC
The branch main has been updated by thierry:
URL: https://cgit.FreeBSD.org/ports/commit/?id=4f4b7701836b67c04cc29dac13395b2f722641eb
commit 4f4b7701836b67c04cc29dac13395b2f722641eb
Author: GenericRikka <rikka.goering@outlook.de>
AuthorDate: 2026-06-17 23:57:41 +0000
Commit: Thierry Thomas <thierry@FreeBSD.org>
CommitDate: 2026-06-18 16:14:29 +0000
net/ucx: Fix libucm early-init panic and resolve gtest suite failures
PR: 296120
---
net/ucx/Makefile | 5 +-
net/ucx/files/patch-src_ucm_util_reloc.c | 112 ++++++++++++++++++++-
.../files/patch-test_gtest_ucp_test__ucp__am.cc | 13 +++
3 files changed, 125 insertions(+), 5 deletions(-)
diff --git a/net/ucx/Makefile b/net/ucx/Makefile
index 22cc4a832fef..2ee03bb259e5 100644
--- a/net/ucx/Makefile
+++ b/net/ucx/Makefile
@@ -1,5 +1,6 @@
PORTNAME= ucx
DISTVERSION= 1.20.1
+PORTREVISION= 1
CATEGORIES= net
MASTER_SITES= https://github.com/openucx/ucx/releases/download/v${DISTVERSION}/
@@ -57,6 +58,8 @@ UMAD_CONFIGURE_OFF= --with-mad=no
post-patch:
${REINPLACE_CMD} 's|^examplesdir = $$(pkgdatadir)/examples$$|examplesdir = ${EXAMPLESDIR}|' \
${WRKSRC}/examples/Makefile.am
+ ${REINPLACE_CMD} 's|/run/user|/var/run/user|' \
+ ${WRKSRC}/src/ucs/vfs/sock/vfs_sock.h
post-install:
${MV} ${STAGEDIR}${ETCDIR}/ucx.conf ${STAGEDIR}${ETCDIR}/ucx.conf.sample
@@ -64,6 +67,6 @@ post-install:
do-test:
cd ${WRKSRC}/test/gtest && \
${SETENV} ${TEST_ENV} ${MAKE_CMD} && \
- ${SETENV} ${TEST_ENV} ./gtest --gtest_filter=-malloc_hook*:sysv/*:test_rcache*:test_rcache_pfn*:test_vfs_sock*:test_datatype.hlist_for_each_extract_if:tcp/test_uct_pending.pending_fairness*:tcp/test_uct_peer_failure.purge_failed_peer*:tcp/test_uct_pending.pending_purge*:tcp/test_uct_iface.is_reachable*:tcp/test_uct_perf*:tcp/test_uct_loopback*:tcp/test_uct_tcp.listener_flood_connect_and_send_large*:tcp/test_uct_tcp.listener_flood_connect_and_send_small*:tcp/test_uct_tcp.check_addr_len*:shm*/*:mm_tcp/*:ib_shm/*:ud_tcp/*:all/*:*/test_ucp_am*:*/test_ucp_loopback*:tcp/test_ucp_perf*:*/test_ucp_proto_mock_self.rkey_ptr*:*/test_ucp_tag_probe*:test_config.test_config_file:test_config.test_config_file_parse_files:signal/*:*/test_async.many_timers*:*/test_ucp_peer_failure_keepalive*:*/test_ucp_mmap*:self/test_ucp_wakeup.signal*:tcp/test_ucp_wakeup.signal*:tcp/test_proto_reset.am_eager_multi_bcopy*:tcp/test_uct_sockaddr.err_handle*:tcp/test_ucp_sockaddr_protocols_diff_net_devices*:
*.*rndv*:*/test_ucp_tag_match_rndv_align*:tcp/test_ucp_sockaddr_iface_activate*
+ ${SETENV} ${TEST_ENV} ./gtest --gtest_filter=-malloc_hook*:sysv/*:test_rcache*:test_rcache_pfn*:test_vfs_sock*:test_datatype.hlist_for_each_extract_if:tcp/test_uct_pending.pending_fairness*:tcp/test_uct_peer_failure.purge_failed_peer*:tcp/test_uct_pending.pending_purge*:tcp/test_uct_iface.is_reachable*:tcp/test_uct_perf*:tcp/test_uct_loopback*:tcp/test_uct_tcp.listener_flood_connect_and_send_large*:tcp/test_uct_tcp.listener_flood_connect_and_send_small*:tcp/test_uct_tcp.check_addr_len*:shm*/*:mm_tcp/*:ib_shm/*:ud_tcp/*:all/*:*/test_ucp_loopback*:tcp/test_ucp_perf*:*/test_ucp_proto_mock_self.rkey_ptr*:test_config.test_config_file:test_config.test_config_file_parse_files:signal/*:*/test_async.many_timers*:*/test_ucp_peer_failure_keepalive*:self/test_ucp_wakeup.signal*:tcp/test_ucp_wakeup.signal*:tcp/test_proto_reset.am_eager_multi_bcopy*:tcp/test_uct_sockaddr.err_handle*:tcp/test_ucp_sockaddr_protocols_diff_net_devices*:tcp/test_ucp_sockaddr_iface_activate*:*/test_ucp_atomi
c*:*/test_ucp_mmap*:*/test_ucp_tag_match_rndv_align*:*/test_ucp_tag_probe*:tcp/test_ucp_sockaddr.*close_during_rndv*:tcp/test_ucp_sockaddr_protocols_err*::*test_ucp_wireup_1sided.stress_connect*
.include <bsd.port.mk>
diff --git a/net/ucx/files/patch-src_ucm_util_reloc.c b/net/ucx/files/patch-src_ucm_util_reloc.c
index 30991731f7b4..07920dcb8abf 100644
--- a/net/ucx/files/patch-src_ucm_util_reloc.c
+++ b/net/ucx/files/patch-src_ucm_util_reloc.c
@@ -1,6 +1,21 @@
---- src/ucm/util/reloc.c.orig 2026-02-04 09:52:46 UTC
+--- src/ucm/util/reloc.c.orig 2026-06-17 21:33:49 UTC
+++ src/ucm/util/reloc.c
-@@ -97,8 +97,15 @@ ucm_reloc_get_pointer(ElfW(Addr) base, const ElfW(Phdr
+@@ -28,12 +28,9 @@
+ #include <fcntl.h>
+ #include <link.h>
+ #include <limits.h>
++#include <sys/sysctl.h>
++#include <sys/user.h>
+
+-#if HAVE_DECL_GETAUXVAL
+-#include <sys/auxv.h>
+-#endif
+-
+-
+ /* Ensure this macro is defined (from <link.h>) - otherwise, cppcheck might
+ fail with an "unknown macro" warning */
+ #ifndef ElfW
+@@ -97,8 +94,15 @@ ucm_reloc_get_pointer(ElfW(Addr) base, const ElfW(Phdr
{
uintptr_t entry = ucm_reloc_get_entry(base, dphdr, tag);
@@ -18,7 +33,96 @@
return UCS_PTR_BYTE_OFFSET(base, entry);
#else
return (void *)entry;
-@@ -353,7 +360,8 @@ static ucs_status_t ucm_reloc_dl_info_get(const struct
+@@ -118,84 +122,10 @@ static ucs_status_t ucm_reloc_get_aux_phsize(int *phsi
+
+ static ucs_status_t ucm_reloc_get_aux_phsize(int *phsize_p)
+ {
+-#define UCM_RELOC_AUXV_BUF_LEN 16
+- static const char *proc_auxv_filename = "/proc/self/auxv";
+- static int phsize = 0;
+- ucm_auxv_t buffer[UCM_RELOC_AUXV_BUF_LEN];
+- ucm_auxv_t *auxv;
+- unsigned count;
+- ssize_t nread;
+- int found;
+- int fd;
+-
+- /* Can avoid lock here - worst case we'll read the file more than once */
+- if (phsize != 0) {
+- *phsize_p = phsize;
+- return UCS_OK;
+- }
+-
+-#if HAVE_DECL_GETAUXVAL
+- phsize = getauxval(AT_PHENT);
+- if (phsize > 0) {
+- *phsize_p = phsize;
+- return UCS_OK;
+- }
+-#endif
+-
+- fd = open(proc_auxv_filename, O_RDONLY);
+- if (fd < 0) {
+- ucm_error("failed to open '%s' for reading: %m", proc_auxv_filename);
+- return UCS_ERR_IO_ERROR;
+- }
+-
+- if (RUNNING_ON_VALGRIND) {
+- /* Work around a bug caused by valgrind's fake /proc/self/auxv -
+- * every time this file is opened when running with valgrind, a
+- * a duplicate of the same fd is returned, so all share the same
+- * file offset.
+- */
+- ucm_reloc_file_lock(fd, F_WRLCK);
+- lseek(fd, 0, SEEK_SET);
+- }
+-
+- /* Use small buffer on the stack, avoid using malloc() */
+- found = 0;
+- do {
+- nread = read(fd, buffer, sizeof(buffer));
+- if (nread < 0) {
+- ucm_error("failed to read %lu bytes from %s (ret=%ld): %m",
+- sizeof(buffer), proc_auxv_filename, nread);
+- break;
+- }
+-
+- count = nread / sizeof(buffer[0]);
+- for (auxv = buffer; (auxv < (buffer + count)) && (auxv->type != AT_NULL);
+- ++auxv)
+- {
+- if ((auxv->type == AT_PHENT) && (auxv->value > 0)) {
+- found = 1;
+- phsize = auxv->value;
+- ucm_debug("read phent from %s: %d", proc_auxv_filename, phsize);
+- if (phsize == 0) {
+- ucm_error("phsize is 0");
+- }
+- break;
+- }
+- }
+- } while ((count > 0) && !found);
+-
+- if (RUNNING_ON_VALGRIND) {
+- ucm_reloc_file_lock(fd, F_UNLCK);
+- }
+- close(fd);
+-
+- if (!found) {
+- ucm_error("AT_PHENT entry not found in %s", proc_auxv_filename);
+- return UCS_ERR_NO_ELEM;
+- }
+-
+- *phsize_p = phsize;
+- return UCS_OK;
++ /* TODO: Implement full FreeBSD RTLD binary patching engine support.
++ * Enforcing UCS_ERR_UNSUPPORTED stubs out libucm for this iteration
++ * to prevent early-init memory interposition conflicts. */
++ return UCS_ERR_UNSUPPORTED;
+ }
+
+ ElfW(Rela) *ucm_reloc_find_sym(void *table, size_t table_size, const char *symbol,
+@@ -353,7 +283,8 @@ static ucs_status_t ucm_reloc_dl_info_get(const struct
if (phdr->p_type == PT_LOAD) {
/* Found loadable section - update address range */
dl_info->start = ucs_min(dl_info->start, dlpi_addr + phdr->p_vaddr);
@@ -28,7 +132,7 @@
found_pt_load = 1;
} else if (phdr->p_type == PT_DYNAMIC) {
/* Found dynamic section */
-@@ -673,10 +681,13 @@ static int ucm_dlclose(void *handle)
+@@ -673,10 +604,13 @@ static int ucm_dlclose(void *handle)
* cached information anyway, and it may be re-added on the next call to
* ucm_reloc_apply_patch().
*/
diff --git a/net/ucx/files/patch-test_gtest_ucp_test__ucp__am.cc b/net/ucx/files/patch-test_gtest_ucp_test__ucp__am.cc
new file mode 100644
index 000000000000..6ab2ff1fcc8a
--- /dev/null
+++ b/net/ucx/files/patch-test_gtest_ucp_test__ucp__am.cc
@@ -0,0 +1,13 @@
+--- test/gtest/ucp/test_ucp_am.cc.orig 2026-06-17 18:31:13 UTC
++++ test/gtest/ucp/test_ucp_am.cc
+@@ -124,7 +124,9 @@ ucs_status_t test_ucp_am::am_handler(test_ucp_am *me,
+ std::vector<char> cmp(length, (char)length);
+ std::vector<char> databuf(length, 'r');
+
+- memcpy(&databuf[0], data, length);
++ if (length > 0) {
++ memcpy(&databuf[0], data, length);
++ }
+
+ EXPECT_EQ(cmp, databuf);
+