|
| 1 | +diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c |
| 2 | +index 96a400ee29c..aae59a1293f 100644 |
| 3 | +--- a/ext/opcache/ZendAccelerator.c |
| 4 | ++++ b/ext/opcache/ZendAccelerator.c |
| 5 | +@@ -2055,6 +2055,8 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type) |
| 6 | + } |
| 7 | + |
| 8 | + if (file_handle->opened_path) { |
| 9 | ++ zend_shared_alloc_lock(); |
| 10 | ++ |
| 11 | + bucket = zend_accel_hash_find_entry(&ZCSG(hash), file_handle->opened_path); |
| 12 | + |
| 13 | + if (bucket) { |
| 14 | +@@ -2063,13 +2065,13 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type) |
| 15 | + if (key && !persistent_script->corrupted) { |
| 16 | + HANDLE_BLOCK_INTERRUPTIONS(); |
| 17 | + SHM_UNPROTECT(); |
| 18 | +- zend_shared_alloc_lock(); |
| 19 | + zend_accel_add_key(key, bucket); |
| 20 | +- zend_shared_alloc_unlock(); |
| 21 | + SHM_PROTECT(); |
| 22 | + HANDLE_UNBLOCK_INTERRUPTIONS(); |
| 23 | + } |
| 24 | + } |
| 25 | ++ |
| 26 | ++ zend_shared_alloc_unlock(); |
| 27 | + } |
| 28 | + } |
| 29 | + } |
| 30 | +@@ -2323,8 +2325,12 @@ static zend_class_entry* zend_accel_inheritance_cache_add(zend_class_entry *ce, |
| 31 | + ZEND_ASSERT(!(ce->ce_flags & ZEND_ACC_IMMUTABLE)); |
| 32 | + ZEND_ASSERT(ce->ce_flags & ZEND_ACC_LINKED); |
| 33 | + |
| 34 | ++ //SHM_UNPROTECT(); |
| 35 | ++ //zend_shared_alloc_lock(); |
| 36 | + if (!ZCG(accelerator_enabled) || |
| 37 | + (ZCSG(restart_in_progress) && accel_restart_is_active())) { |
| 38 | ++ //zend_shared_alloc_unlock(); |
| 39 | ++ //SHM_PROTECT(); |
| 40 | + return NULL; |
| 41 | + } |
| 42 | + |
| 43 | +@@ -2520,15 +2526,19 @@ static zend_string* persistent_zend_resolve_path(zend_string *filename) |
| 44 | + /* lookup by "not-real" path */ |
| 45 | + key = accel_make_persistent_key(filename); |
| 46 | + if (key) { |
| 47 | ++ zend_shared_alloc_lock(); |
| 48 | + zend_accel_hash_entry *bucket = zend_accel_hash_find_entry(&ZCSG(hash), key); |
| 49 | + if (bucket != NULL) { |
| 50 | + zend_persistent_script *persistent_script = (zend_persistent_script *)bucket->data; |
| 51 | + if (!persistent_script->corrupted) { |
| 52 | + ZCG(cache_opline) = EG(current_execute_data) ? EG(current_execute_data)->opline : NULL; |
| 53 | + ZCG(cache_persistent_script) = persistent_script; |
| 54 | +- return zend_string_copy(persistent_script->script.filename); |
| 55 | ++ zend_string *str = zend_string_copy(persistent_script->script.filename); |
| 56 | ++ zend_shared_alloc_unlock(); |
| 57 | ++ return str; |
| 58 | + } |
| 59 | + } |
| 60 | ++ zend_shared_alloc_unlock(); |
| 61 | + } else { |
| 62 | + ZCG(cache_opline) = NULL; |
| 63 | + ZCG(cache_persistent_script) = NULL; |
| 64 | +@@ -2541,6 +2551,7 @@ static zend_string* persistent_zend_resolve_path(zend_string *filename) |
| 65 | + |
| 66 | + if (resolved_path) { |
| 67 | + /* lookup by real path */ |
| 68 | ++ zend_shared_alloc_lock(); |
| 69 | + zend_accel_hash_entry *bucket = zend_accel_hash_find_entry(&ZCSG(hash), resolved_path); |
| 70 | + if (bucket) { |
| 71 | + zend_persistent_script *persistent_script = (zend_persistent_script *)bucket->data; |
| 72 | +@@ -2549,19 +2560,19 @@ static zend_string* persistent_zend_resolve_path(zend_string *filename) |
| 73 | + /* add another "key" for the same bucket */ |
| 74 | + HANDLE_BLOCK_INTERRUPTIONS(); |
| 75 | + SHM_UNPROTECT(); |
| 76 | +- zend_shared_alloc_lock(); |
| 77 | + zend_accel_add_key(key, bucket); |
| 78 | +- zend_shared_alloc_unlock(); |
| 79 | + SHM_PROTECT(); |
| 80 | + HANDLE_UNBLOCK_INTERRUPTIONS(); |
| 81 | + } else { |
| 82 | + ZSTR_LEN(&ZCG(key)) = 0; |
| 83 | + } |
| 84 | ++ zend_shared_alloc_unlock(); |
| 85 | + ZCG(cache_opline) = EG(current_execute_data) ? EG(current_execute_data)->opline : NULL; |
| 86 | + ZCG(cache_persistent_script) = persistent_script; |
| 87 | + return resolved_path; |
| 88 | + } |
| 89 | + } |
| 90 | ++ zend_shared_alloc_unlock(); |
| 91 | + } |
| 92 | + |
| 93 | + ZCG(cache_opline) = NULL; |
| 94 | +diff --git a/ext/opcache/zend_accelerator_hash.c b/ext/opcache/zend_accelerator_hash.c |
| 95 | +index 2fd3dfb5ed5..484489eff03 100644 |
| 96 | +--- a/ext/opcache/zend_accelerator_hash.c |
| 97 | ++++ b/ext/opcache/zend_accelerator_hash.c |
| 98 | +@@ -31,9 +31,12 @@ static const uint32_t num_prime_numbers = sizeof(prime_numbers) / sizeof(uint32_ |
| 99 | + |
| 100 | + void zend_accel_hash_clean(zend_accel_hash *accel_hash) |
| 101 | + { |
| 102 | ++ ZEND_ASSERT(ZCG(locked)); |
| 103 | ++ |
| 104 | + accel_hash->num_entries = 0; |
| 105 | + accel_hash->num_direct_entries = 0; |
| 106 | + memset(accel_hash->hash_table, 0, sizeof(zend_accel_hash_entry *)*accel_hash->max_num_entries); |
| 107 | ++ memset(accel_hash->hash_entries, 0xf0, sizeof(zend_accel_hash_entry )*accel_hash->max_num_entries); |
| 108 | + } |
| 109 | + |
| 110 | + void zend_accel_hash_init(zend_accel_hash *accel_hash, uint32_t hash_size) |
| 111 | +@@ -65,6 +68,7 @@ void zend_accel_hash_init(zend_accel_hash *accel_hash, uint32_t hash_size) |
| 112 | + return; |
| 113 | + } |
| 114 | + memset(accel_hash->hash_table, 0, sizeof(zend_accel_hash_entry *)*accel_hash->max_num_entries); |
| 115 | ++ memset(accel_hash->hash_entries, 0xf0f0, sizeof(zend_accel_hash_entry )*accel_hash->max_num_entries); |
| 116 | + } |
| 117 | + |
| 118 | + /* Returns NULL if hash is full |
| 119 | +diff --git a/sapi/fpm/fpm/fpm_stdio.c b/sapi/fpm/fpm/fpm_stdio.c |
| 120 | +index 55139a0e02e..7a8b0cd9546 100644 |
| 121 | +--- a/sapi/fpm/fpm/fpm_stdio.c |
| 122 | ++++ b/sapi/fpm/fpm/fpm_stdio.c |
| 123 | +@@ -26,7 +26,7 @@ static int fd_stderr[2]; |
| 124 | + |
| 125 | + int fpm_stdio_init_main(void) |
| 126 | + { |
| 127 | +- int fd = open("/dev/null", O_RDWR); |
| 128 | ++ /*int fd = open("/dev/null", O_RDWR); |
| 129 | + |
| 130 | + if (0 > fd) { |
| 131 | + zlog(ZLOG_SYSERROR, "failed to init stdio: open(\"/dev/null\")"); |
| 132 | +@@ -38,7 +38,7 @@ int fpm_stdio_init_main(void) |
| 133 | + close(fd); |
| 134 | + return -1; |
| 135 | + } |
| 136 | +- close(fd); |
| 137 | ++ close(fd);*/ |
| 138 | + return 0; |
| 139 | + } |
| 140 | + |
| 141 | +@@ -62,11 +62,11 @@ static inline int fpm_use_error_log(void) { |
| 142 | + |
| 143 | + int fpm_stdio_init_final(void) |
| 144 | + { |
| 145 | +- if (0 > fpm_stdio_redirect_stderr_to_error_log() || |
| 146 | ++ /*if (0 > fpm_stdio_redirect_stderr_to_error_log() || |
| 147 | + 0 > fpm_stdio_redirect_stderr_to_dev_null_for_syslog()) { |
| 148 | + |
| 149 | + return -1; |
| 150 | +- } |
| 151 | ++ }*/ |
| 152 | + |
| 153 | + zlog_set_launched(); |
| 154 | + return 0; |
0 commit comments