]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Enforce version drift limits for libuv
authorOndřej Surý <ondrej@isc.org>
Wed, 8 Feb 2023 08:29:54 +0000 (09:29 +0100)
committerMichał Kępień <michal@isc.org>
Thu, 9 Feb 2023 14:04:52 +0000 (15:04 +0100)
libuv support for receiving multiple UDP messages in a single system
call (recvmmsg()) has been tweaked several times between libuv versions
1.35.0 and 1.40.0.  Mixing and matching libuv versions within that span
may lead to assertion failures and is therefore considered harmful, so
try to limit potential damage be preventing users from mixing libuv
versions with distinct sets of recvmmsg()-related flags.

lib/isc/netmgr/netmgr.c

index d7a70a47cc10a99d00fcaa9c69e28a934a31b4ce..1f7e9b0df78459bc2cac43825d14763d150b48b0 100644 (file)
@@ -177,8 +177,10 @@ netmgr_teardown(void *arg) {
 #elif HAVE_DECL_UV_UDP_MMSG_FREE
 #define MINIMAL_UV_VERSION UV_VERSION(1, 40, 0)
 #elif HAVE_DECL_UV_UDP_RECVMMSG
+#define MAXIMAL_UV_VERSION UV_VERSION(1, 39, 99)
 #define MINIMAL_UV_VERSION UV_VERSION(1, 37, 0)
 #else
+#define MAXIMAL_UV_VERSION UV_VERSION(1, 34, 99)
 #define MINIMAL_UV_VERSION UV_VERSION(1, 0, 0)
 #endif
 
@@ -186,10 +188,19 @@ void
 isc_netmgr_create(isc_mem_t *mctx, isc_loopmgr_t *loopmgr, isc_nm_t **netmgrp) {
        isc_nm_t *netmgr = NULL;
 
+#ifdef MAXIMAL_UV_VERSION
+       if (uv_version() > MAXIMAL_UV_VERSION) {
+               FATAL_ERROR("libuv version too new: running with libuv %s "
+                           "when compiled with libuv %s will lead to "
+                           "libuv failures",
+                           uv_version_string(), UV_VERSION_STRING);
+       }
+#endif /* MAXIMAL_UV_VERSION */
+
        if (uv_version() < MINIMAL_UV_VERSION) {
                FATAL_ERROR("libuv version too old: running with libuv %s "
                            "when compiled with libuv %s will lead to "
-                           "libuv failures because of unknown flags",
+                           "libuv failures",
                            uv_version_string(), UV_VERSION_STRING);
        }