Bug#694473: apache2: segmentation fault after reload, maybe PHP

2012-12-23 Thread Stefan Fritsch
severity 694473 grave
reassign 694473 libapache2-mod-php5
retitle 694473 session extension causes endless recursion after graceful reload
found 694473 5.4.4-10
thanks

This is an endless recursion resulting in a stack overflow:

#0 0xb5be0283 in php_session_rfc1867_callback (event=, 
event_data=0x0, extra=0xbfd43a70) at /build/buildd-php5_5.4.4-10-i386-
SZuNyZ/php5-5.4.4/ext/session/session.c:2388

...


#82550 0xb5be0283 in php_session_rfc1867_callback (event=, 
event_data=0x0, extra=0xbfd43a70) at /build/buildd-php5_5.4.4-10-
i386-SZuNyZ/php5-5.4.4/ext/session/session.c:2388

...

It always happens after there has been an graceful reload (i.e.
/etc/init.d/apache2 reload), so it will break after every logrotate (therefore
bumping severity).

The attached patch is a hack to workaround the issue, but it is not a complete 
fix:
If there is another plugin setting php_rfc1867_callback and using the
same logic, there will again be an endless recursion (but this time alternating
between two functions).

I am not familiar enough with php to know what the correct fix would be. Maybe
it should just set a flag during the first time PHP_MINIT_FUNCTION(session) is
called and do nothing the second time around. Or maybe mod_php should make sure
that the static data is re-initialized again.
--- php5-5.4.4.orig/ext/session/session.c
+++ php5-5.4.4/ext/session/session.c
@@ -2192,8 +2192,10 @@
 #ifdef HAVE_LIBMM
 	PHP_MINIT(ps_mm) (INIT_FUNC_ARGS_PASSTHRU);
 #endif
-	php_session_rfc1867_orig_callback = php_rfc1867_callback;
-	php_rfc1867_callback = php_session_rfc1867_callback;
+	if (php_rfc1867_callback != php_session_rfc1867_callback) {
+		php_session_rfc1867_orig_callback = php_rfc1867_callback;
+		php_rfc1867_callback = php_session_rfc1867_callback;
+	}
 
 	/* Register interface */
 	INIT_CLASS_ENTRY(ce, PS_IFACE_NAME, php_session_iface_functions);


Processed: Bug#694473: apache2: segmentation fault after reload, maybe PHP

2012-12-23 Thread Debian Bug Tracking System
Processing commands for cont...@bugs.debian.org:

> severity 694473 grave
Bug #694473 [apache2] apache2: segmentation fault after reload, maybe PHP
Severity set to 'grave' from 'normal'
> reassign 694473 libapache2-mod-php5
Bug #694473 [apache2] apache2: segmentation fault after reload, maybe PHP
Bug reassigned from package 'apache2' to 'libapache2-mod-php5'.
Ignoring request to alter found versions of bug #694473 to the same values 
previously set
Ignoring request to alter fixed versions of bug #694473 to the same values 
previously set
> retitle 694473 session extension causes endless recursion after graceful 
> reload
Bug #694473 [libapache2-mod-php5] apache2: segmentation fault after reload, 
maybe PHP
Changed Bug title to 'session extension causes endless recursion after graceful 
reload' from 'apache2: segmentation fault after reload, maybe PHP'
> found 694473 5.4.4-10
Bug #694473 [libapache2-mod-php5] session extension causes endless recursion 
after graceful reload
Marked as found in versions php5/5.4.4-10.
> thanks
Stopping processing here.

Please contact me if you need assistance.
-- 
694473: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=694473
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems


--
To UNSUBSCRIBE, email to debian-apache-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/handler.s.c.135627539113673.transcr...@bugs.debian.org