diff --git a/net/ucx/Makefile b/net/ucx/Makefile index 22cc4a832fef..2ee03bb259e5 100644 --- a/net/ucx/Makefile +++ b/net/ucx/Makefile @@ -1,69 +1,72 @@ PORTNAME= ucx DISTVERSION= 1.20.1 +PORTREVISION= 1 CATEGORIES= net MASTER_SITES= https://github.com/openucx/ucx/releases/download/v${DISTVERSION}/ MAINTAINER= rikka.goering@outlook.de COMMENT= Unified Communication X framework (UCX) WWW= https://openucx.org/ LICENSE= BSD3CLAUSE LICENSE_FILE= ${WRKSRC}/LICENSE ONLY_FOR_ARCHS= aarch64 amd64 powerpc64le ONLY_FOR_ARCHS_REASON= uses arch-specific CPU backends; armv7 is not supported upstream and does not build on FreeBSD BUILD_DEPENDS= ${LOCALBASE}/share/aclocal/ax_c_float_words_bigendian.m4:devel/autoconf-archive USES= autoreconf dos2unix gmake libtool pkgconfig USE_LDCONFIG= yes GNU_CONFIGURE= yes CONFIGURE_ARGS= --disable-doxygen-doc \ --enable-compiler-opt=0 \ --enable-gtest \ --enable-mt \ --with-go=no CONFIGURE_ENV= GIT=/usr/bin/false INSTALL_TARGET= install-strip TEST_ENV+= LD_LIBRARY_PATH=${STAGEDIR}${PREFIX}/lib CFLAGS+= -Wno-error CXXFLAGS+= -Wno-error LDFLAGS+= -lexecinfo -lprocstat -lutil PORTDOCS= * PORTEXAMPLES= * OPTIONS_DEFINE= DOCS EXAMPLES FUSE IBVERBS IODEMO PERFTEST UMAD OPTIONS_DEFAULT= FUSE IODEMO PERFTEST OPTIONS_SUB= yes IBVERBS_DESC= Enable InfiniBand/RDMA (verbs) transport IODEMO_DESC= Install io_demo test application PERFTEST_DESC= Install ucx_perftest benchmarks UMAD_DESC= Build/install perftest MAD plugin (umad) FUSE_LIB_DEPENDS= libfuse3.so:filesystems/fusefs-libs3 FUSE_CONFIGURE_ON= --with-fuse3=${LOCALBASE} FUSE_CONFIGURE_OFF= --with-fuse3=no IBVERBS_CONFIGURE_ON= --with-verbs=${LOCALBASE} IBVERBS_CONFIGURE_OFF= --with-verbs=no UMAD_IMPLIES= IBVERBS PERFTEST UMAD_CONFIGURE_ON= --with-mad=${LOCALBASE} 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 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_atomic*:*/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 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,46 +1,150 @@ ---- 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 + #include + #include ++#include ++#include + +-#if HAVE_DECL_GETAUXVAL +-#include +-#endif +- +- + /* Ensure this macro is defined (from ) - 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); -#if defined(__riscv) - /* On RISC-V these are not pointers but offsets */ +#if defined(__FreeBSD__) || defined(__riscv) + /* + * On FreeBSD, the dynamic-section pointer entries we consume here + * (DT_SYMTAB, DT_STRTAB, DT_JMPREL, DT_RELA, ...) are observed through + * dl_iterate_phdr() as object-relative virtual addresses for shared + * objects, so they must be rebased by dlpi_addr before dereference. + * + * RISC-V already required the same treatment. + */ 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); - dl_info->end = ucs_max(dl_info->end, phdr->p_vaddr + phdr->p_memsz); + dl_info->end = ucs_max(dl_info->end, dlpi_addr + phdr->p_vaddr + + phdr->p_memsz); 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(). */ - dl_name = ucm_reloc_get_dl_name(lm_entry->l_name, lm_entry->l_addr, + ElfW(Addr) dlpi_addr; + dlpi_addr = (ElfW(Addr))(uintptr_t)lm_entry->l_addr; + + dl_name = ucm_reloc_get_dl_name(lm_entry->l_name, dlpi_addr, dl_name_buffer, sizeof(dl_name_buffer)); pthread_mutex_lock(&ucm_reloc_patch_list_lock); - ucm_reloc_dl_info_cleanup(lm_entry->l_addr, dl_name); + ucm_reloc_dl_info_cleanup(dlpi_addr, dl_name); pthread_mutex_unlock(&ucm_reloc_patch_list_lock); } 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 cmp(length, (char)length); + std::vector databuf(length, 'r'); + +- memcpy(&databuf[0], data, length); ++ if (length > 0) { ++ memcpy(&databuf[0], data, length); ++ } + + EXPECT_EQ(cmp, databuf); +