|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
Patch php-5.3.2-apc_deadlock.patch for Reproducible crash Bug #46025Patch version 2010-05-31 04:50 UTC Return to Bug #46025 | Download this patchThis patch renders other patches obsolete Obsolete patches: Patch Revisions:Developer: askalski@gmail.com
diff --git a/Zend/zend.c b/Zend/zend.c
index cd8ba77..11203da 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -551,6 +551,11 @@ static void executor_globals_ctor(zend_executor_globals *executor_globals TSRMLS
EG(exit_status) = 0;
EG(saved_fpu_cw) = NULL;
EG(active) = 0;
+
+ /* {{{ apc deadlock prevention (askalski) */
+ EG(blocking_interruptions) = 0;
+ EG(bailout_deferred) = 0;
+ /* }}} */
}
/* }}} */
@@ -803,6 +808,13 @@ ZEND_API void _zend_bailout(char *filename, uint lineno) /* {{{ */
{
TSRMLS_FETCH();
+ /* {{{ apc deadlock prevention (askalski) */
+ if (EG(blocking_interruptions)) {
+ EG(bailout_deferred) = 1;
+ return;
+ }
+ /* }}} */
+
if (!EG(bailout)) {
zend_output_debug_string(1, "%s(%d) : Bailed out without a bailout address!", filename, lineno);
exit(-1);
diff --git a/Zend/zend.h b/Zend/zend.h
index 3332e7c..dca3689 100644
--- a/Zend/zend.h
+++ b/Zend/zend.h
@@ -642,8 +642,23 @@ END_EXTERN_C()
#define ZEND_UV(name) (zend_uv.name)
-#define HANDLE_BLOCK_INTERRUPTIONS() if (zend_block_interruptions) { zend_block_interruptions(); }
-#define HANDLE_UNBLOCK_INTERRUPTIONS() if (zend_unblock_interruptions) { zend_unblock_interruptions(); }
+/* {{{ apc deadlock prevention (askalski) */
+#define HANDLE_BLOCK_INTERRUPTIONS() \
+ if (!EG(blocking_interruptions)++) { \
+ if (zend_block_interruptions) { \
+ zend_block_interruptions(); \
+ } \
+ }
+#define HANDLE_UNBLOCK_INTERRUPTIONS() \
+ if (!--EG(blocking_interruptions)) { \
+ if (zend_unblock_interruptions) { \
+ zend_unblock_interruptions(); \
+ } \
+ if (EG(bailout_deferred)) { \
+ zend_bailout(); \
+ } \
+ }
+/* }}} */
BEGIN_EXTERN_C()
ZEND_API void zend_message_dispatcher(long message, void *data TSRMLS_DC);
diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h
index f1f6c50..ec9c4c7 100644
--- a/Zend/zend_globals.h
+++ b/Zend/zend_globals.h
@@ -257,6 +257,11 @@ struct _zend_executor_globals {
void *saved_fpu_cw;
void *reserved[ZEND_MAX_RESERVED_RESOURCES];
+
+ /* {{{ apc deadlock prevention (askalski) */
+ int blocking_interruptions;
+ int bailout_deferred;
+ /* }}} */
};
struct _zend_ini_scanner_globals {
diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c
index 70d6bf7..f823d8e 100644
--- a/Zend/zend_hash.c
+++ b/Zend/zend_hash.c
@@ -20,6 +20,9 @@
/* $Id: zend_hash.c 293155 2010-01-05 20:46:53Z sebastian $ */
#include "zend.h"
+/* {{{ apc deadlock prevention (askalski) */
+#include "zend_globals.h"
+/* }}} */
#define CONNECT_TO_BUCKET_DLLIST(element, list_head) \
(element)->pNext = (list_head); \
|
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 18 22:00:01 2025 UTC |