As discussed in <http://bugs.debian.org/711213>, we encountered somewhat
non-deterministic SIGSEGVs at the end of the mod_perl test suite when
building our packages based on the httpd24 branch (merged with the
2.0.8 release.)

It turns out the 'pre_cleanup' function cleanup_perl_global_providers()
was getting called after mod_perl had been unloaded, because the cleanup
was registered against the server process pool. This pool has a longer
lifetime than that of the mod_perl shared object.

As suggested by Stefan Fritsch, registering the cleanup against the
configuration pool seems to work better. This fixes the problem completely
according to my tests.  Proposed patch attached.
-- 
Niko Tyni   nt...@debian.org
>From 75662f4285bad8d28fe787d1293bdd95a535cad1 Mon Sep 17 00:00:00 2001
From: Niko Tyni <nt...@debian.org>
Date: Fri, 14 Jun 2013 14:07:22 +0300
Subject: [PATCH] Make sure authn and authz providers are cleaned up in time

The authn and authz providers need to be registered in the configuration
pool rather than the server process pool.  The latter outlives the load
time of the mod_perl shared object, so cleanup hooks could get called
after the registered functions were unloaded, causing SIGSEGVs and other
undefined behaviour.

Fix suggested by Stefan Fritsch.

Bug-Debian: http://bugs.debian.org/711213
---
 src/modules/perl/modperl_cmd.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/modules/perl/modperl_cmd.c b/src/modules/perl/modperl_cmd.c
index 4ae0a62..d14b330 100644
--- a/src/modules/perl/modperl_cmd.c
+++ b/src/modules/perl/modperl_cmd.c
@@ -419,7 +419,7 @@ MP_CMD_SRV_DECLARE(init_handlers)
 
 MP_CMD_SRV_DECLARE2(authz_provider)
 {
-    apr_pool_t *p = parms->server->process->pool;
+    apr_pool_t *p = parms->pool;
     char *name = apr_pstrdup(p, arg1);
     char *cb = apr_pstrdup(p, arg2);
 
@@ -431,7 +431,7 @@ MP_CMD_SRV_DECLARE2(authz_provider)
 
 MP_CMD_SRV_DECLARE2(authn_provider)
 {
-    apr_pool_t *p = parms->server->process->pool;
+    apr_pool_t *p = parms->pool;
     char *name = apr_pstrdup(p, arg1);
     char *cb = apr_pstrdup(p, arg2);
 
-- 
1.7.10.4


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@perl.apache.org
For additional commands, e-mail: dev-h...@perl.apache.org

Reply via email to