com php-src: Merge branch 'PHP-7.4': ext/opcache/shared_alloc _win32.c

From: Date: Wed, 29 Jul 2020 16:31:28 +0000
Subject: com php-src: Merge branch 'PHP-7.4': ext/opcache/shared_alloc _win32.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-112446@lists.php.net to get a copy of this message
Commit: 88a3bdd1e4a91989e7a7ceea63bdb77eeabb6af3 Author: Christoph M. Becker <cmbecker69@gmx.de> Wed, 29 Jul 2020 18:31:28 +0200 Parents: 62cd52a41a659a404a17652865660e8c739bd964 2bcc419800f0974609804cc00e345c8609291fc9 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=88a3bdd1e4a91989e7a7ceea63bdb77eeabb6af3 Log: Merge branch 'PHP-7.4' * PHP-7.4: Fix #73060: php failed with error after temp folder cleaned up Bugs: https://bugs.php.net/73060 Changed paths: MM ext/opcache/shared_alloc_win32.c Diff: diff --cc ext/opcache/shared_alloc_win32.c index 856e33696a,a75ec852c4..6cda647104 --- a/ext/opcache/shared_alloc_win32.c +++ b/ext/opcache/shared_alloc_win32.c @@@ -206,17 -172,8 +172,17 @@@ static int zend_shared_alloc_reattach(s return ALLOC_FAILURE; } return ALLOC_FAIL_MAPPING; + } else { + DWORD old; + + if (!VirtualProtect(mapping_base, requested_size, PAGE_READWRITE, &old)) { + err = GetLastError(); + zend_win_error_message(ACCEL_LOG_FATAL, "VirtualProtect() failed", err); + return ALLOC_FAIL_MAPPING; + } } + - smm_shared_globals = (zend_smm_shared_globals *) mapping_base; + smm_shared_globals = (zend_smm_shared_globals *) ((char*)mapping_base + ACCEL_BASE_POINTER_SIZE); return SUCCESSFULLY_REATTACHED; } @@@ -334,32 -291,12 +300,20 @@@ static int create_segments(size_t reque *error_in = "MapViewOfFile"; return ALLOC_FAILURE; } else { - char *mmap_base_file; - void *execute_ex_base = (void *)execute_ex; - FILE *fp; + DWORD old; + + if (!VirtualProtect(mapping_base, requested_size, PAGE_READWRITE, &old)) { + err = GetLastError(); + zend_win_error_message(ACCEL_LOG_FATAL, "VirtualProtect() failed", err); + return ALLOC_FAILURE; + } - mmap_base_file = get_mmap_base_file(); - fp = fopen(mmap_base_file, "w"); - if (!fp) { - err = GetLastError(); - zend_shared_alloc_unlock_win32(); - zend_win_error_message(ACCEL_LOG_WARNING, mmap_base_file, err); - zend_win_error_message(ACCEL_LOG_FATAL, "Unable to write base address", err); - return ALLOC_FAILURE; - } - fprintf(fp, "%p\n", mapping_base); - fprintf(fp, "%p\n", execute_ex_base); - fclose(fp); ++ + ((void**)mapping_base)[0] = mapping_base; + ((void**)mapping_base)[1] = (void*)execute_ex; } - shared_segment->pos = 0; - shared_segment->size = requested_size; + shared_segment->pos = ACCEL_BASE_POINTER_SIZE; + shared_segment->size = requested_size - ACCEL_BASE_POINTER_SIZE; zend_shared_alloc_unlock_win32();

« previous php.cvs (#112446) next »