pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bind920: move the workaround to the isc_random_uniform() wrapper.



Module Name:	pkgsrc-wip
Committed By:	Havard Eidnes <he%NetBSD.org@localhost>
Pushed By:	he
Date:		Fri Oct 24 10:23:49 2025 +0200
Changeset:	021228382c88dfcfb119fdda47252fb96ac7a069

Modified Files:
	bind920/Makefile
	bind920/distinfo
Added Files:
	bind920/patches/patch-lib_isc_include_isc_random.h
Removed Files:
	bind920/patches/patch-lib_dns_zone.c

Log Message:
bind920: move the workaround to the isc_random_uniform() wrapper.

Based on discussion w/maintainers.
Bump PKGREVISION.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=021228382c88dfcfb119fdda47252fb96ac7a069

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 bind920/Makefile                                   |  2 +-
 bind920/distinfo                                   |  2 +-
 bind920/patches/patch-lib_dns_zone.c               | 19 -------------------
 bind920/patches/patch-lib_isc_include_isc_random.h | 17 +++++++++++++++++
 4 files changed, 19 insertions(+), 21 deletions(-)

diffs:
diff --git a/bind920/Makefile b/bind920/Makefile
index 917e65da49..b7df416793 100644
--- a/bind920/Makefile
+++ b/bind920/Makefile
@@ -2,7 +2,7 @@
 
 DISTNAME=	bind-${BIND_VERSION}
 PKGNAME=	${DISTNAME:S/-P/pl/}
-PKGREVISION=	1
+PKGREVISION=	2
 CATEGORIES=	net
 MASTER_SITES=	https://downloads.isc.org/isc/bind9/${BIND_VERSION}/
 EXTRACT_SUFX=	.tar.xz
diff --git a/bind920/distinfo b/bind920/distinfo
index 7040712171..fa537ca716 100644
--- a/bind920/distinfo
+++ b/bind920/distinfo
@@ -4,4 +4,4 @@ BLAKE2s (bind-9.20.15.tar.xz) = a9f184b388370068ddb2317417750e5261af5ff0c311ad52
 SHA512 (bind-9.20.15.tar.xz) = 087d7114279274898fdc846d50216167e0895d83c3fa01372cd5f1b9a106a1ed1b4ca588d86543da8c299577f4a6762713680b8e114514badb43b03d2a0fac82
 Size (bind-9.20.15.tar.xz) = 5765964 bytes
 SHA1 (patch-configure.ac) = d3b9bb82c8e164135b93a76d5c53ad40521226e2
-SHA1 (patch-lib_dns_zone.c) = 79b44bcf8a5bafdedb4e86b17e148f29c343b96a
+SHA1 (patch-lib_isc_include_isc_random.h) = fed7dc480cfbbf2ba11bdd0a16a5433b8a7c30b5
diff --git a/bind920/patches/patch-lib_dns_zone.c b/bind920/patches/patch-lib_dns_zone.c
deleted file mode 100644
index 82e996b47b..0000000000
--- a/bind920/patches/patch-lib_dns_zone.c
+++ /dev/null
@@ -1,19 +0,0 @@
-$NetBSD$
-
-Avoid division by zero on NetBSD, when arc4random_uniform(0) ends
-up being called...
-
---- lib/dns/zone.c.orig	2025-10-23 18:46:39.034862846 +0000
-+++ lib/dns/zone.c
-@@ -1035,8 +1035,9 @@ static const char *dbargv_default[] = { 
- #define DNS_ZONE_JITTER_ADD(a, b, c)                                         \
- 	do {                                                                 \
- 		isc_interval_t _i;                                           \
--		uint32_t _j;                                                 \
--		_j = (b) - isc_random_uniform((b) / 4);                      \
-+		uint32_t _j, _b = b;                                         \
-+		if (_b < 4) { _b = 4; }					     \
-+		_j = (_b) - isc_random_uniform((_b) / 4);                    \
- 		isc_interval_set(&_i, _j, 0);                                \
- 		if (isc_time_add((a), &_i, (c)) != ISC_R_SUCCESS) {          \
- 			dns_zone_log(zone, ISC_LOG_WARNING,                  \
diff --git a/bind920/patches/patch-lib_isc_include_isc_random.h b/bind920/patches/patch-lib_isc_include_isc_random.h
new file mode 100644
index 0000000000..dc0100e3e9
--- /dev/null
+++ b/bind920/patches/patch-lib_isc_include_isc_random.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+Avoid calling arc4random_uniform() with a too small argument,
+to avoid the mis-handled 0 argument on NetBSD (SIGFPE core dump,
+due to "mod 0" being attempted).
+
+--- lib/isc/include/isc/random.h.orig	2025-10-23 19:53:03.005527744 +0000
++++ lib/isc/include/isc/random.h
+@@ -30,7 +30,7 @@ ISC_LANG_BEGINDECLS
+ #if HAVE_ARC4RANDOM && !defined(__linux__)
+ #define isc_random32()			arc4random()
+ #define isc_random_buf(buf, buflen)	arc4random_buf(buf, buflen)
+-#define isc_random_uniform(upper_bound) arc4random_uniform(upper_bound)
++#define isc_random_uniform(upper_bound) ((upper_bound) < 2 ? arc4random() & (upper_bound) : arc4random_uniform(upper_bound))
+ #else /* HAVE_ARC4RANDOM && !defined(__linux__) */
+ uint32_t
+ isc_random32(void);


Home | Main Index | Thread Index | Old Index