aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Arnold <mat@FreeBSD.org>2019-06-03 12:46:25 +0000
committerMathieu Arnold <mat@FreeBSD.org>2019-06-03 12:46:25 +0000
commitef99a88efc89e197022c76aefd0d926872a0f3af (patch)
treefa241d932bdf446143f09fcface22077d6dda074
parent069f6aaaaae850f44c1e4ff336d8de0f53fe14bf (diff)
downloadports-ef99a88efc89e197022c76aefd0d926872a0f3af.tar.gz
ports-ef99a88efc89e197022c76aefd0d926872a0f3af.zip
MFH: r503379
Fix a possible race between udp dispatch and socket code. PR: 237640 Obtained from: https://gitlab.isc.org/isc-projects/bind9/merge_requests/1992
Notes
Notes: svn path=/branches/2019Q2/; revision=503383
-rw-r--r--dns/bind914/Makefile2
-rw-r--r--dns/bind914/files/patch-lib_isc_unix_socket.c35
2 files changed, 36 insertions, 1 deletions
diff --git a/dns/bind914/Makefile b/dns/bind914/Makefile
index c5aad859e17d..2d8fe91ee26a 100644
--- a/dns/bind914/Makefile
+++ b/dns/bind914/Makefile
@@ -8,7 +8,7 @@ PORTVERSION= ${ISCVERSION:S/-P/P/:S/b/.b/:S/a/.a/:S/rc/.rc/}
PORTREVISION= 0
.else
# dns/bind913 here
-PORTREVISION= 0
+PORTREVISION= 1
.endif
CATEGORIES= dns net ipv6
MASTER_SITES= ISC/bind9/${ISCVERSION}
diff --git a/dns/bind914/files/patch-lib_isc_unix_socket.c b/dns/bind914/files/patch-lib_isc_unix_socket.c
new file mode 100644
index 000000000000..06db1cc3e9f5
--- /dev/null
+++ b/dns/bind914/files/patch-lib_isc_unix_socket.c
@@ -0,0 +1,35 @@
+From e517c18d98c248e891558ce5194e3663d244f956 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Witold=20Kr=C4=99cicki?= <wpk@isc.org>
+Date: Fri, 31 May 2019 10:40:52 +0200
+Subject: [PATCH 1/2] Fix a possible race between udp dispatch and socket code
+
+There's a small possibility of race between udp dispatcher and
+socket code - socket code can still hold internal reference to a
+socket while dispatcher calls isc_socket_open, which can cause
+an assertion failure. Fix it by relaxing the assertion test, and
+instead simply locking the socket in isc_socket_open.
+
+--- lib/isc/unix/socket.c.orig 2019-05-10 04:51:34 UTC
++++ lib/isc/unix/socket.c
+@@ -2598,15 +2598,16 @@ isc_socket_open(isc_socket_t *sock0) {
+
+ REQUIRE(VALID_SOCKET(sock));
+
+- REQUIRE(isc_refcount_current(&sock->references) == 1);
+- /*
+- * We don't need to retain the lock hereafter, since no one else has
+- * this socket.
+- */
++ LOCK(&sock->lock);
++
++ REQUIRE(isc_refcount_current(&sock->references) >= 1);
+ REQUIRE(sock->fd == -1);
+ REQUIRE(sock->threadid == -1);
+
+ result = opensocket(sock->manager, sock, NULL);
++
++ UNLOCK(&sock->lock);
++
+ if (result != ISC_R_SUCCESS) {
+ sock->fd = -1;
+ } else {