[Pkg-apache-commits] r1240 - in /trunk/apr-util: changelog patches/00list patches/017_apr_thread_pool-1.3.10-fixes.dpatch
sf at alioth.debian.org
sf at alioth.debian.org
Fri Oct 1 20:05:47 UTC 2010
Author: sf
Date: Fri Oct 1 20:05:30 2010
New Revision: 1240
URL: http://svn.debian.org/wsvn/pkg-apache/?sc=1&rev=1240
Log:
backport some fixes from 1.3.10
Added:
trunk/apr-util/patches/017_apr_thread_pool-1.3.10-fixes.dpatch (with props)
Modified:
trunk/apr-util/changelog
trunk/apr-util/patches/00list
Modified: trunk/apr-util/changelog
URL: http://svn.debian.org/wsvn/pkg-apache/trunk/apr-util/changelog?rev=1240&op=diff
==============================================================================
--- trunk/apr-util/changelog (original)
+++ trunk/apr-util/changelog Fri Oct 1 20:05:30 2010
@@ -1,3 +1,13 @@
+apr-util (1.3.9+dfsg-5) UNRELEASED; urgency=low
+
+ * Backports from 1.3.10:
+ - apr_thread_pool: Fix some potential deadlock situations. PR 49709.
+ - apr_thread_pool_create: Fix pool corruption caused by multithreaded
+ use of the pool when multiple initial threads are created. PR 47843.
+ - apr_thread_pool_create: Only set the output variable on success.
+
+ -- Stefan Fritsch <sf at debian.org> Fri, 01 Oct 2010 21:52:57 +0200
+
apr-util (1.3.9+dfsg-4) unstable; urgency=high
* CVE-2010-1623: Fix denial of service vulnerability through memory
Modified: trunk/apr-util/patches/00list
URL: http://svn.debian.org/wsvn/pkg-apache/trunk/apr-util/patches/00list?rev=1240&op=diff
==============================================================================
--- trunk/apr-util/patches/00list (original)
+++ trunk/apr-util/patches/00list Fri Oct 1 20:05:30 2010
@@ -8,4 +8,5 @@
014_apu_config_dont_list_indep_libs
015_disable_expat_buildconf.dpatch
016_CVE-2010-1623.dpatch
+017_apr_thread_pool-1.3.10-fixes.dpatch
099_alternate_md4_md5_impl
Added: trunk/apr-util/patches/017_apr_thread_pool-1.3.10-fixes.dpatch
URL: http://svn.debian.org/wsvn/pkg-apache/trunk/apr-util/patches/017_apr_thread_pool-1.3.10-fixes.dpatch?rev=1240&op=file
==============================================================================
--- trunk/apr-util/patches/017_apr_thread_pool-1.3.10-fixes.dpatch (added)
+++ trunk/apr-util/patches/017_apr_thread_pool-1.3.10-fixes.dpatch Fri Oct 1 20:05:30 2010
@@ -1,0 +1,170 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+#
+## DP: Backports from 1.3.10:
+## DP:
+## DP: https://issues.apache.org/bugzilla/show_bug.cgi?id=49709
+## DP: apr_thread_pool: Fix some potential deadlock situations.
+## DP: The use of two mutexes allowed race conditions between
+## DP: releasing one and acquiring another.
+## DP:
+## DP: https://issues.apache.org/bugzilla/show_bug.cgi?id=47843
+## DP: apr_thread_pool_create: Fix pool corruption caused by multithread use
+## DP: of the pool when multiple initial threads are created.
+## DP:
+## DP: apr_thread_pool_create(): Only set the output thread pool handle on
+## DP: success
+ at DPATCH@
+--- a/misc/apr_thread_pool.c
++++ b/misc/apr_thread_pool.c
+@@ -72,7 +72,6 @@
+ struct apr_thread_list *busy_thds;
+ struct apr_thread_list *idle_thds;
+ apr_thread_mutex_t *lock;
+- apr_thread_mutex_t *cond_lock;
+ apr_thread_cond_t *cond;
+ volatile int terminated;
+ struct apr_thread_pool_tasks *recycled_tasks;
+@@ -95,16 +94,9 @@
+ if (APR_SUCCESS != rv) {
+ return rv;
+ }
+- rv = apr_thread_mutex_create(&me->cond_lock, APR_THREAD_MUTEX_UNNESTED,
+- me->pool);
+- if (APR_SUCCESS != rv) {
+- apr_thread_mutex_destroy(me->lock);
+- return rv;
+- }
+ rv = apr_thread_cond_create(&me->cond, me->pool);
+ if (APR_SUCCESS != rv) {
+ apr_thread_mutex_destroy(me->lock);
+- apr_thread_mutex_destroy(me->cond_lock);
+ return rv;
+ }
+ me->tasks = apr_palloc(me->pool, sizeof(*me->tasks));
+@@ -148,7 +140,6 @@
+ CATCH_ENOMEM:
+ rv = APR_ENOMEM;
+ apr_thread_mutex_destroy(me->lock);
+- apr_thread_mutex_destroy(me->cond_lock);
+ apr_thread_cond_destroy(me->cond);
+ FINAL_EXIT:
+ return rv;
+@@ -321,16 +312,12 @@
+ else
+ wait = -1;
+
+- apr_thread_mutex_unlock(me->lock);
+- apr_thread_mutex_lock(me->cond_lock);
+ if (wait >= 0) {
+- rv = apr_thread_cond_timedwait(me->cond, me->cond_lock, wait);
++ rv = apr_thread_cond_timedwait(me->cond, me->lock, wait);
+ }
+ else {
+- rv = apr_thread_cond_wait(me->cond, me->cond_lock);
++ rv = apr_thread_cond_wait(me->cond, me->lock);
+ }
+- apr_thread_mutex_unlock(me->cond_lock);
+- apr_thread_mutex_lock(me->lock);
+ }
+
+ /* idle thread been asked to stop, will be joined */
+@@ -350,7 +337,6 @@
+ apr_sleep(20 * 1000); /* spin lock with 20 ms */
+ }
+ apr_thread_mutex_destroy(_self->lock);
+- apr_thread_mutex_destroy(_self->cond_lock);
+ apr_thread_cond_destroy(_self->cond);
+ return APR_SUCCESS;
+ }
+@@ -362,33 +348,42 @@
+ {
+ apr_thread_t *t;
+ apr_status_t rv = APR_SUCCESS;
++ apr_thread_pool_t *tp;
+
+- *me = apr_pcalloc(pool, sizeof(**me));
+- if (!*me) {
+- return APR_ENOMEM;
+- }
++ *me = NULL;
++ tp = apr_pcalloc(pool, sizeof(apr_thread_pool_t));
+
+- (*me)->pool = pool;
++ tp->pool = pool;
+
+- rv = thread_pool_construct(*me, init_threads, max_threads);
++ rv = thread_pool_construct(tp, init_threads, max_threads);
+ if (APR_SUCCESS != rv) {
+- *me = NULL;
+ return rv;
+ }
+- apr_pool_cleanup_register(pool, *me, thread_pool_cleanup,
++ apr_pool_cleanup_register(pool, tp, thread_pool_cleanup,
+ apr_pool_cleanup_null);
+
+ while (init_threads) {
+- rv = apr_thread_create(&t, NULL, thread_pool_func, *me, (*me)->pool);
++ /* Grab the mutex as apr_thread_create() and thread_pool_func() will
++ * allocate from (*me)->pool. This is dangerous if there are multiple
++ * initial threads to create.
++ */
++ apr_thread_mutex_lock(tp->lock);
++ rv = apr_thread_create(&t, NULL, thread_pool_func, tp, tp->pool);
++ apr_thread_mutex_unlock(tp->lock);
+ if (APR_SUCCESS != rv) {
+ break;
+ }
+- ++(*me)->thd_cnt;
+- if ((*me)->thd_cnt > (*me)->thd_high)
+- (*me)->thd_high = (*me)->thd_cnt;
++ tp->thd_cnt++;
++ if (tp->thd_cnt > tp->thd_high) {
++ tp->thd_high = tp->thd_cnt;
++ }
+ --init_threads;
+ }
+
++ if (rv == APR_SUCCESS) {
++ *me = tp;
++ }
++
+ return rv;
+ }
+
+@@ -521,10 +516,8 @@
+ me->thd_high = me->thd_cnt;
+ }
+ }
+- apr_thread_mutex_unlock(me->lock);
+- apr_thread_mutex_lock(me->cond_lock);
+ apr_thread_cond_signal(me->cond);
+- apr_thread_mutex_unlock(me->cond_lock);
++ apr_thread_mutex_unlock(me->lock);
+ return rv;
+ }
+
+@@ -576,11 +569,9 @@
+ me->thd_high = me->thd_cnt;
+ }
+ }
+- apr_thread_mutex_unlock(me->lock);
+
+- apr_thread_mutex_lock(me->cond_lock);
+ apr_thread_cond_signal(me->cond);
+- apr_thread_mutex_unlock(me->cond_lock);
++ apr_thread_mutex_unlock(me->lock);
+
+ return rv;
+ }
+@@ -838,9 +829,9 @@
+
+ elt = trim_threads(me, &cnt, 1);
+
+- apr_thread_mutex_lock(me->cond_lock);
++ apr_thread_mutex_lock(me->lock);
+ apr_thread_cond_broadcast(me->cond);
+- apr_thread_mutex_unlock(me->cond_lock);
++ apr_thread_mutex_unlock(me->lock);
+
+ n_dbg = 0;
+ if (NULL != (head = elt)) {
Propchange: trunk/apr-util/patches/017_apr_thread_pool-1.3.10-fixes.dpatch
------------------------------------------------------------------------------
svn:executable = *
More information about the Pkg-apache-commits
mailing list