summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bind-9.5-recv-race.patch172
-rw-r--r--bind.spec5
2 files changed, 176 insertions, 1 deletions
diff --git a/bind-9.5-recv-race.patch b/bind-9.5-recv-race.patch
new file mode 100644
index 0000000..2207d53
--- /dev/null
+++ b/bind-9.5-recv-race.patch
@@ -0,0 +1,172 @@
+diff -up bind-9.5.0b2/lib/isc/unix/socket.c.recv bind-9.5.0b2/lib/isc/unix/socket.c
+--- bind-9.5.0b2/lib/isc/unix/socket.c.recv 2008-04-10 16:45:33.000000000 +0200
++++ bind-9.5.0b2/lib/isc/unix/socket.c 2008-04-10 17:00:46.000000000 +0200
+@@ -261,10 +261,10 @@ static isc_result_t allocate_socket(isc_
+ static void destroy(isc_socket_t **);
+ static void internal_accept(isc_task_t *, isc_event_t *);
+ static void internal_connect(isc_task_t *, isc_event_t *);
+-static void internal_recv(isc_task_t *, isc_event_t *);
++static void internal_recv(isc_event_t *);
+ static void internal_send(isc_task_t *, isc_event_t *);
+ static void internal_fdwatch_write(isc_task_t *, isc_event_t *);
+-static void internal_fdwatch_read(isc_task_t *, isc_event_t *);
++static void internal_fdwatch_read(isc_event_t *);
+ static void process_cmsg(isc_socket_t *, struct msghdr *, isc_socketevent_t *);
+ static void build_msghdr_send(isc_socket_t *, isc_socketevent_t *,
+ struct msghdr *, struct iovec *, size_t *);
+@@ -1830,7 +1830,7 @@ isc_socket_detach(isc_socket_t **socketp
+ *
+ * The socket and manager must be locked before calling this function.
+ */
+-static void
++static isc_boolean_t
+ dispatch_recv(isc_socket_t *sock) {
+ intev_t *iev;
+ isc_socketevent_t *ev;
+@@ -1841,7 +1841,7 @@ dispatch_recv(isc_socket_t *sock) {
+ if (sock->type != isc_sockettype_fdwatch) {
+ ev = ISC_LIST_HEAD(sock->recv_list);
+ if (ev == NULL)
+- return;
++ return ISC_FALSE;
+ socket_log(sock, NULL, EVENT, NULL, 0, 0,
+ "dispatch_recv: event %p -> task %p",
+ ev, ev->ev_sender);
+@@ -1855,13 +1855,16 @@ dispatch_recv(isc_socket_t *sock) {
+
+ sock->references++;
+ iev->ev_sender = sock;
++ iev->ev_arg = sock;
+ if (sock->type == isc_sockettype_fdwatch)
+- iev->ev_action = internal_fdwatch_read;
++ internal_fdwatch_read (iev);
+ else
+- iev->ev_action = internal_recv;
+- iev->ev_arg = sock;
++ internal_recv (iev);
+
+- isc_task_send(sender, (isc_event_t **)&iev);
++ if (sock->references == 0)
++ return ISC_TRUE;
++
++ return ISC_FALSE;
+ }
+
+ static void
+@@ -2228,7 +2231,7 @@ internal_accept(isc_task_t *me, isc_even
+ }
+
+ static void
+-internal_recv(isc_task_t *me, isc_event_t *ev) {
++internal_recv(isc_event_t *ev) {
+ isc_socketevent_t *dev;
+ isc_socket_t *sock;
+
+@@ -2237,21 +2240,13 @@ internal_recv(isc_task_t *me, isc_event_
+ sock = ev->ev_sender;
+ INSIST(VALID_SOCKET(sock));
+
+- LOCK(&sock->lock);
+- socket_log(sock, NULL, IOEVENT,
+- isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_INTERNALRECV,
+- "internal_recv: task %p got event %p", me, ev);
+-
+ INSIST(sock->pending_recv == 1);
+ sock->pending_recv = 0;
+
+ INSIST(sock->references > 0);
+ sock->references--; /* the internal event is done with this socket */
+- if (sock->references == 0) {
+- UNLOCK(&sock->lock);
+- destroy(&sock);
++ if (sock->references == 0)
+ return;
+- }
+
+ /*
+ * Try to do as much I/O as possible on this socket. There are no
+@@ -2289,7 +2284,6 @@ internal_recv(isc_task_t *me, isc_event_
+ if (!ISC_LIST_EMPTY(sock->recv_list))
+ select_poke(sock->manager, sock->fd, SELECT_POKE_READ);
+
+- UNLOCK(&sock->lock);
+ }
+
+ static void
+@@ -2388,7 +2382,7 @@ internal_fdwatch_write(isc_task_t *me, i
+ }
+
+ static void
+-internal_fdwatch_read(isc_task_t *me, isc_event_t *ev) {
++internal_fdwatch_read(isc_event_t *ev) {
+ isc_socket_t *sock;
+ int more_data;
+
+@@ -2400,31 +2394,19 @@ internal_fdwatch_read(isc_task_t *me, is
+ sock = (isc_socket_t *)ev->ev_sender;
+ INSIST(VALID_SOCKET(sock));
+
+- LOCK(&sock->lock);
+- socket_log(sock, NULL, IOEVENT,
+- isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_INTERNALRECV,
+- "internal_fdwatch_read: task %p got event %p", me, ev);
+-
+ INSIST(sock->pending_recv == 1);
+
+- UNLOCK(&sock->lock);
+- more_data = (sock->fdwatchcb)(me, sock, sock->fdwatcharg);
+- LOCK(&sock->lock);
++ INSIST(0); /* We should not be here */
+
+ sock->pending_recv = 0;
+
+ INSIST(sock->references > 0);
+ sock->references--; /* the internal event is done with this socket */
+- if (sock->references == 0) {
+- UNLOCK(&sock->lock);
+- destroy(&sock);
++ if (sock->references == 0)
+ return;
+- }
+
+ if (more_data)
+ select_poke(sock->manager, sock->fd, SELECT_POKE_READ);
+-
+- UNLOCK(&sock->lock);
+ }
+
+ static void
+@@ -2434,6 +2416,7 @@ process_fds(isc_socketmgr_t *manager, in
+ int i;
+ isc_socket_t *sock;
+ isc_boolean_t unlock_sock;
++ isc_boolean_t destroy_sock;
+
+ REQUIRE(maxfd <= (int)FD_SETSIZE);
+
+@@ -2462,6 +2445,7 @@ process_fds(isc_socketmgr_t *manager, in
+
+ sock = manager->fds[i];
+ unlock_sock = ISC_FALSE;
++ destroy_sock = ISC_FALSE;
+ if (FD_ISSET(i, readfds)) {
+ if (sock == NULL) {
+ FD_CLR(i, &manager->read_fds);
+@@ -2473,7 +2457,7 @@ process_fds(isc_socketmgr_t *manager, in
+ if (sock->listener)
+ dispatch_accept(sock);
+ else
+- dispatch_recv(sock);
++ destroy_sock = dispatch_recv(sock);
+ }
+ FD_CLR(i, &manager->read_fds);
+ }
+@@ -2497,6 +2481,8 @@ process_fds(isc_socketmgr_t *manager, in
+ }
+ if (unlock_sock)
+ UNLOCK(&sock->lock);
++ if (destroy_sock)
++ destroy(&sock);
+ }
+ }
+
diff --git a/bind.spec b/bind.spec
index 0c9d489..a40a718 100644
--- a/bind.spec
+++ b/bind.spec
@@ -58,6 +58,7 @@ Patch71: bind-9.5-overflow.patch
Patch72: bind-9.5-dlz-64bit.patch
Patch87: bind-9.5-parallel-build.patch
Patch90: bind-9.5-libcap.patch
+Patch91: bind-9.5-recv-race.patch
# SDB patches
Patch11: bind-9.3.2b2-sdbsrc.patch
@@ -236,6 +237,7 @@ cp -fp contrib/dbus/{dbus_mgr.h,dbus_service.h} bin/named/include/named
%patch83 -p1 -b .libidn2
%patch85 -p1 -b .libidn3
%patch87 -p1 -b .parallel
+%patch91 -p1 -b .recv-race
:;
@@ -390,7 +392,7 @@ for f in my.internal.zone.db slaves/my.slave.internal.zone.db slaves/my.ddns.int
echo '@ in soa localhost. root 1 3H 15M 1W 1D
ns localhost.' > sample/var/named/$f;
done
-/usr/bin/tail -n '+'`/bin/egrep -n '\\$Id: bind.spec,v 1.257 2008/05/05 09:41:55 atkac Exp $/+1/' | bc` bin/rndc/rndc.conf | sed '/Sample rndc configuration file./{p;i\
+/usr/bin/tail -n '+'`/bin/egrep -n '\\$Id: bind.spec,v 1.258 2008/05/05 09:46:24 atkac Exp $/+1/' | bc` bin/rndc/rndc.conf | sed '/Sample rndc configuration file./{p;i\
*\
* NOTE: you only need to create this file if it is to\
* differ from the following default contents:
@@ -648,6 +650,7 @@ rm -rf ${RPM_BUILD_ROOT}
- bind-9.5-transfer-segv.patch
- bind-9.5-mudflap.patch
- updated bind-9.5-libcap.patch
+- added bind-9.5-recv-race.patch from F8 branch (#400461)
* Wed Apr 02 2008 Adam Tkac <atkac redhat com> 32:9.5.0-29.3.b2
- fixed named.conf.sample file (#437569)