net/libzmq4: Update to 4.3.4, Fix security issues

- Patches removed were incorporated upstream.

Changelog:  https://github.com/zeromq/libzmq/releases/tag/v4.3.2
      https://github.com/zeromq/libzmq/releases/tag/v4.3.3
      https://github.com/zeromq/libzmq/releases/tag/v4.3.4

PR:		255102
Approved by:	koobs (maintainer, implicit)
MFH:		2021Q2
Security:	21ec4428-bdaa-11eb-a04e-641c67a117d8
Security:	6954a2b0-bda8-11eb-a04e-641c67a117d8

Co-authored-by: Danilo G. Baio <dbaio@FreeBSD.org>
This commit is contained in:
Thomas Petig 2021-05-25 20:16:19 -03:00 committed by Danilo G. Baio
parent b48ef2625f
commit f3f486e422
6 changed files with 19 additions and 231 deletions

View file

@ -1,7 +1,6 @@
PORTNAME= libzmq4
DISTVERSIONPREFIX= v
DISTVERSION= 4.3.1
PORTREVISION= 1
DISTVERSION= 4.3.4
CATEGORIES= net
MASTER_SITES= https://github.com/zeromq/libzmq/releases/download/${DISTVERSIONFULL}/
DISTNAME= zeromq-${DISTVERSION}
@ -68,7 +67,6 @@ CFLAGS+= -Wno-long-long
CONFIGURE_ARGS+= --enable-debug
.endif
.if !${PORT_OPTIONS:MSODIUM} && !${PORT_OPTIONS:MTWEETNACL}
CONFIGURE_ARGS+= --disable-curve
.endif

View file

@ -1,3 +1,3 @@
TIMESTAMP = 1548985858
SHA256 (zeromq-4.3.1.tar.gz) = bcbabe1e2c7d0eec4ed612e10b94b112dd5f06fcefa994a0c79a45d835cd21eb
SIZE (zeromq-4.3.1.tar.gz) = 1490122
TIMESTAMP = 1621855285
SHA256 (zeromq-4.3.4.tar.gz) = c593001a89f5a85dd2ddf564805deb860e02471171b3f204944857336295c3e5
SIZE (zeromq-4.3.4.tar.gz) = 2486520

View file

@ -1,179 +0,0 @@
From 4147957a5eec57ec7a2a416dca74c3c0299a3432 Mon Sep 17 00:00:00 2001
From: Luca Boccassi <bluca@debian.org>
Date: Sun, 13 Jan 2019 13:08:10 +0000
Subject: [PATCH 1/2] Problem: test_security_zap fails on architectures that
disallow unaligned pointer access
Solution: use memcpy instead of doing pointer arithmetics with casting
and dereferencing to fix the error on sparc64
---
tests/testutil_security.hpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git tests/testutil_security.hpp tests/testutil_security.hpp
index 90999118c..437bfb298 100644
--- tests/testutil_security.hpp
+++ tests/testutil_security.hpp
@@ -345,7 +345,7 @@ static int get_monitor_event_internal (void *monitor_,
uint8_t *data = (uint8_t *) zmq_msg_data (&msg);
uint16_t event = *(uint16_t *) (data);
if (value_)
- *value_ = *(uint32_t *) (data + 2);
+ memcpy (value_, data + 2, sizeof (uint32_t));
// Second frame in message contains event address
zmq_msg_init (&msg);
From f64b697095c6d8862bdfd2a159857e915bbf20ee Mon Sep 17 00:00:00 2001
From: Luca Boccassi <bluca@debian.org>
Date: Sun, 13 Jan 2019 14:50:07 +0000
Subject: [PATCH 2/2] Problem: tests use hard-coded fixed IPC file path
Solution: use wildcards or random directories to avoid races when
multiple users are running the same test on the same machine
---
tests/test_pair_ipc.cpp | 9 +++++++--
tests/test_rebind_ipc.cpp | 13 ++++++++-----
tests/test_reconnect_ivl.cpp | 10 +++++++---
tests/test_use_fd.cpp | 24 +++++++++++++++++++-----
4 files changed, 41 insertions(+), 15 deletions(-)
diff --git tests/test_pair_ipc.cpp tests/test_pair_ipc.cpp
index c9a216dd2..ab4dde350 100644
--- tests/test_pair_ipc.cpp
+++ tests/test_pair_ipc.cpp
@@ -44,11 +44,16 @@ void tearDown ()
void test_roundtrip ()
{
+ char my_endpoint[256];
+ size_t len = sizeof (my_endpoint);
+
void *sb = test_context_socket (ZMQ_PAIR);
- TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "ipc:///tmp/test_pair_ipc"));
+ TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "ipc://*"));
+ TEST_ASSERT_SUCCESS_ERRNO (
+ zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, my_endpoint, &len));
void *sc = test_context_socket (ZMQ_PAIR);
- TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sc, "ipc:///tmp/test_pair_ipc"));
+ TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sc, my_endpoint));
bounce (sb, sc);
diff --git tests/test_rebind_ipc.cpp tests/test_rebind_ipc.cpp
index 830d18030..784641270 100644
--- tests/test_rebind_ipc.cpp
+++ tests/test_rebind_ipc.cpp
@@ -42,24 +42,27 @@ void tearDown ()
teardown_test_context ();
}
-static const char *SOCKET_ADDR = "ipc:///tmp/test_rebind_ipc";
-
void test_rebind_ipc ()
{
+ char my_endpoint[256];
+ size_t len = sizeof (my_endpoint);
+
void *sb0 = test_context_socket (ZMQ_PUSH);
void *sb1 = test_context_socket (ZMQ_PUSH);
- TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb0, SOCKET_ADDR));
+ TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb0, "ipc://*"));
+ TEST_ASSERT_SUCCESS_ERRNO (
+ zmq_getsockopt (sb0, ZMQ_LAST_ENDPOINT, my_endpoint, &len));
void *sc = test_context_socket (ZMQ_PULL);
- TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sc, SOCKET_ADDR));
+ TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sc, my_endpoint));
send_string_expect_success (sb0, "42", 0);
recv_string_expect_success (sc, "42", 0);
test_context_socket_close (sb0);
- TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb1, SOCKET_ADDR));
+ TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb1, my_endpoint));
send_string_expect_success (sb1, "42", 0);
recv_string_expect_success (sc, "42", 0);
diff --git tests/test_reconnect_ivl.cpp tests/test_reconnect_ivl.cpp
index b67b40e5f..6dd0e4cd2 100644
--- tests/test_reconnect_ivl.cpp
+++ tests/test_reconnect_ivl.cpp
@@ -71,11 +71,15 @@ void test_reconnect_ivl_against_pair_socket (const char *my_endpoint_,
#if !defined(ZMQ_HAVE_WINDOWS) && !defined(ZMQ_HAVE_GNU)
void test_reconnect_ivl_ipc (void)
{
- const char *ipc_endpoint = "ipc:///tmp/test_reconnect_ivl";
+ char my_endpoint[256];
+ size_t len = sizeof (my_endpoint);
+
void *sb = test_context_socket (ZMQ_PAIR);
- TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, ipc_endpoint));
+ TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "ipc://*"));
+ TEST_ASSERT_SUCCESS_ERRNO (
+ zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, my_endpoint, &len));
- test_reconnect_ivl_against_pair_socket (ipc_endpoint, sb);
+ test_reconnect_ivl_against_pair_socket (my_endpoint, sb);
test_context_socket_close (sb);
}
#endif
diff --git tests/test_use_fd.cpp tests/test_use_fd.cpp
index 67414f5bf..e9852b13d 100644
--- tests/test_use_fd.cpp
+++ tests/test_use_fd.cpp
@@ -237,24 +237,38 @@ void pre_allocate_sock_ipc_int (void *zmq_socket_, const char *path_)
sizeof (struct sockaddr_un));
}
+char ipc_endpoint[16];
+
void pre_allocate_sock_ipc (void *sb_, char *my_endpoint_)
{
- pre_allocate_sock_ipc_int (sb_, "/tmp/test_use_fd_ipc");
- strcpy (my_endpoint_, "ipc:///tmp/test_use_fd_ipc");
+ strcpy (ipc_endpoint, "tmpXXXXXX");
+
+#ifdef HAVE_MKDTEMP
+ TEST_ASSERT_TRUE (mkdtemp (ipc_endpoint));
+ strcat (ipc_endpoint, "/ipc");
+#else
+ int fd = mkstemp (ipc_endpoint);
+ TEST_ASSERT_TRUE (fd != -1);
+ close (fd);
+#endif
+
+ pre_allocate_sock_ipc_int (sb_, ipc_endpoint);
+ strcpy (my_endpoint_, "ipc://");
+ strcat (my_endpoint_, ipc_endpoint);
}
void test_req_rep_ipc ()
{
test_req_rep (pre_allocate_sock_ipc);
- TEST_ASSERT_SUCCESS_ERRNO (unlink ("/tmp/test_use_fd_ipc"));
+ TEST_ASSERT_SUCCESS_ERRNO (unlink (ipc_endpoint));
}
void test_pair_ipc ()
{
test_pair (pre_allocate_sock_ipc);
- TEST_ASSERT_SUCCESS_ERRNO (unlink ("/tmp/test_use_fd_ipc"));
+ TEST_ASSERT_SUCCESS_ERRNO (unlink (ipc_endpoint));
}
void test_client_server_ipc ()
@@ -262,7 +276,7 @@ void test_client_server_ipc ()
#if defined(ZMQ_SERVER) && defined(ZMQ_CLIENT)
test_client_server (pre_allocate_sock_ipc);
- TEST_ASSERT_SUCCESS_ERRNO (unlink ("/tmp/test_use_fd_ipc"));
+ TEST_ASSERT_SUCCESS_ERRNO (unlink (ipc_endpoint));
#endif
}

View file

@ -1,45 +0,0 @@
From d55956574d3b98268ec31045b012029ffc4b1a8c Mon Sep 17 00:00:00 2001
From: Luca Boccassi <bluca@debian.org>
Date: Mon, 14 Jan 2019 00:10:08 +0000
Subject: [PATCH] Problem: test_rebind_ipc still fails
Solution: create manually the random IPC file to reuse
---
tests/test_rebind_ipc.cpp | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git tests/test_rebind_ipc.cpp tests/test_rebind_ipc.cpp
index 784641270..b14cb81d9 100644
--- tests/test_rebind_ipc.cpp
+++ tests/test_rebind_ipc.cpp
@@ -44,15 +44,25 @@ void tearDown ()
void test_rebind_ipc ()
{
- char my_endpoint[256];
- size_t len = sizeof (my_endpoint);
+ char my_endpoint[32], random_file[16];
+ strcpy (random_file, "tmpXXXXXX");
+
+#ifdef HAVE_MKDTEMP
+ TEST_ASSERT_TRUE (mkdtemp (random_file));
+ strcat (random_file, "/ipc");
+#else
+ int fd = mkstemp (random_file);
+ TEST_ASSERT_TRUE (fd != -1);
+ close (fd);
+#endif
+
+ strcpy (my_endpoint, "ipc://");
+ strcat (my_endpoint, random_file);
void *sb0 = test_context_socket (ZMQ_PUSH);
void *sb1 = test_context_socket (ZMQ_PUSH);
- TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb0, "ipc://*"));
- TEST_ASSERT_SUCCESS_ERRNO (
- zmq_getsockopt (sb0, ZMQ_LAST_ENDPOINT, my_endpoint, &len));
+ TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb0, my_endpoint));
void *sc = test_context_socket (ZMQ_PULL);
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sc, my_endpoint));

View file

@ -0,0 +1,11 @@
--- tests/testutil.hpp.orig 2021-01-03 21:46:02 UTC
+++ tests/testutil.hpp
@@ -45,6 +45,8 @@
#include <arpa/inet.h>
#include <unistd.h>
#include <stdlib.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
#endif
// This defines the settle time used in tests; raise this if we

View file

@ -2,7 +2,7 @@ include/zmq_utils.h
include/zmq.h
lib/libzmq.so
lib/libzmq.so.5
lib/libzmq.so.5.2.1
lib/libzmq.so.5.2.4
libdata/pkgconfig/libzmq.pc
%%MANPAGES%%man/man3/zmq_atomic_counter_dec.3.gz
%%MANPAGES%%man/man3/zmq_atomic_counter_destroy.3.gz
@ -13,6 +13,7 @@ libdata/pkgconfig/libzmq.pc
%%MANPAGES%%man/man3/zmq_bind.3.gz
%%MANPAGES%%man/man3/zmq_close.3.gz
%%MANPAGES%%man/man3/zmq_connect.3.gz
%%MANPAGES%%man/man3/zmq_connect_peer.3.gz
%%MANPAGES%%man/man3/zmq_ctx_get.3.gz
%%MANPAGES%%man/man3/zmq_ctx_new.3.gz
%%MANPAGES%%man/man3/zmq_ctx_set.3.gz
@ -31,6 +32,7 @@ libdata/pkgconfig/libzmq.pc
%%MANPAGES%%man/man3/zmq_msg_get.3.gz
%%MANPAGES%%man/man3/zmq_msg_gets.3.gz
%%MANPAGES%%man/man3/zmq_msg_init.3.gz
%%MANPAGES%%man/man3/zmq_msg_init_buffer.3.gz
%%MANPAGES%%man/man3/zmq_msg_init_data.3.gz
%%MANPAGES%%man/man3/zmq_msg_init_size.3.gz
%%MANPAGES%%man/man3/zmq_msg_more.3.gz
@ -53,6 +55,7 @@ libdata/pkgconfig/libzmq.pc
%%MANPAGES%%man/man3/zmq_setsockopt.3.gz
%%MANPAGES%%man/man3/zmq_socket.3.gz
%%MANPAGES%%man/man3/zmq_socket_monitor.3.gz
%%MANPAGES%%man/man3/zmq_socket_monitor_versioned.3.gz
%%MANPAGES%%man/man3/zmq_strerror.3.gz
%%MANPAGES%%man/man3/zmq_timers.3.gz
%%MANPAGES%%man/man3/zmq_unbind.3.gz