|
|
422d6c |
--- subversion-1.10.2/subversion/libsvn_repos/authz.c
|
|
|
422d6c |
+++ subversion-1.10.2/subversion/libsvn_repos/authz.c
|
|
|
422d6c |
@@ -130,6 +130,30 @@
|
|
|
422d6c |
static svn_object_pool__t *filtered_pool = NULL;
|
|
|
422d6c |
static svn_atomic_t authz_pool_initialized = FALSE;
|
|
|
422d6c |
|
|
|
422d6c |
+/*
|
|
|
422d6c |
+ * Ensure that we will initialize authz again if the pool which
|
|
|
422d6c |
+ * our authz caches depend on is cleared.
|
|
|
422d6c |
+ *
|
|
|
422d6c |
+ * HTTPD may run pre/post config hooks multiple times and clear
|
|
|
422d6c |
+ * its global configuration pool which our authz pools depend on.
|
|
|
422d6c |
+ * This happens in a non-threaded context during HTTPD's intialization
|
|
|
422d6c |
+ * and HTTPD's main loop, so it is safe to reset static variables here.
|
|
|
422d6c |
+ * (And any applications which cleared this pool while SVN threads
|
|
|
422d6c |
+ * were running would crash no matter what.)
|
|
|
422d6c |
+ *
|
|
|
422d6c |
+ * See issue #4880, "Use-after-free of object-pools in
|
|
|
422d6c |
+ * subversion/libsvn_repos/authz.c when used as httpd module"
|
|
|
422d6c |
+ */
|
|
|
422d6c |
+static apr_status_t
|
|
|
422d6c |
+deinit_authz(void *data)
|
|
|
422d6c |
+{
|
|
|
422d6c |
+ /* The two object pools run their own cleanup handlers. */
|
|
|
422d6c |
+ authz_pool = NULL;
|
|
|
422d6c |
+ filtered_pool = NULL;
|
|
|
422d6c |
+ authz_pool_initialized = FALSE;
|
|
|
422d6c |
+ return APR_SUCCESS;
|
|
|
422d6c |
+}
|
|
|
422d6c |
+
|
|
|
422d6c |
/* Implements svn_atomic__err_init_func_t. */
|
|
|
422d6c |
static svn_error_t *
|
|
|
422d6c |
synchronized_authz_initialize(void *baton, apr_pool_t *pool)
|
|
|
422d6c |
@@ -143,6 +167,7 @@
|
|
|
422d6c |
SVN_ERR(svn_object_pool__create(&authz_pool, multi_threaded, pool));
|
|
|
422d6c |
SVN_ERR(svn_object_pool__create(&filtered_pool, multi_threaded, pool));
|
|
|
422d6c |
|
|
|
422d6c |
+ apr_pool_cleanup_register(pool, NULL, deinit_authz, apr_pool_cleanup_null);
|
|
|
422d6c |
return SVN_NO_ERROR;
|
|
|
422d6c |
}
|
|
|
422d6c |
|