summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcovener <covener@13f79535-47bb-0310-9956-ffa450edef68>2016-06-27 16:08:25 +0000
committercovener <covener@13f79535-47bb-0310-9956-ffa450edef68>2016-06-27 16:08:25 +0000
commita17d7a2b31d52ccda6a7ea873bd82b52794367ad (patch)
tree523868ee53c360c1483cdf3c3c42882b725d9bb3
parent58a02d05b24558f307d396942cd7f65edcfdefa0 (diff)
downloadlibapr-a17d7a2b31d52ccda6a7ea873bd82b52794367ad.tar.gz
Merge r1750374 from trunk:
Fix a case where the cleanup for a pollset w/o the thread-safe flag would try to zap a random/garbage message queue identifier. In httpd, this could happen with e.g. mod_cgi's short-lived, non-threadsafe pollset. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1750377 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--CHANGES4
-rw-r--r--poll/unix/z_asio.c8
2 files changed, 9 insertions, 3 deletions
diff --git a/CHANGES b/CHANGES
index 061764fdd..d8bdc45d2 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,10 @@
-*- coding: utf-8 -*-
Changes for APR 1.5.3
+ *) apr_pollset_poll: Fix an issue on z/OS where unpredictable
+ message queue identifiers could be removed when non-threadsafe
+ pollsets cleaned up. [Eric Covener]
+
*) apr_proc_mutex-pthread: Refcount shared mutexes usage to avoid
destruction while still is use by some process(es). PR 49504.
[Yann Ylavic]
diff --git a/poll/unix/z_asio.c b/poll/unix/z_asio.c
index 6537d4909..6da4ee8e9 100644
--- a/poll/unix/z_asio.c
+++ b/poll/unix/z_asio.c
@@ -247,9 +247,11 @@ static apr_status_t asio_pollset_cleanup(apr_pollset_t *pollset)
int rv;
DBG(4, "entered\n");
- rv = msgctl(pollset->p->msg_q, IPC_RMID, NULL);
+ if (pollset->flags & APR_POLLSET_THREADSAFE) {
+ rv = msgctl(pollset->p->msg_q, IPC_RMID, NULL);
+ DBG1(4, "asio_pollset_cleanup: msgctl(IPC_RMID) returned %d\n", rv);
+ }
- DBG1(4, "exiting, msgctl(IPC_RMID) returned %d\n", rv);
return rv;
}
@@ -264,7 +266,7 @@ static apr_status_t asio_pollset_create(apr_pollset_t *pollset,
DBG1(2, "entered, flags: %x\n", flags);
- priv = pollset->p = apr_palloc(p, sizeof(*priv));
+ priv = pollset->p = apr_pcalloc(p, sizeof(*priv));
if (flags & APR_POLLSET_THREADSAFE) {
#if APR_HAS_THREADS