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

From: Date: Wed, 29 Jul 2020 08:17:22 +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-112420@lists.php.net to get a copy of this message
Commit: fc3439a7b3b2e1c3a75cdd2d70d89aab35e8799e Author: Christoph M. Becker <cmbecker69@gmx.de> Wed, 29 Jul 2020 10:17:22 +0200 Parents: 9eb79900859a509a6370f51a0da7b6bddc9a7602 e1f6ab3388f509782857557ee1e40a66b2bb6455 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=fc3439a7b3b2e1c3a75cdd2d70d89aab35e8799e 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,0105fbb2df..337cf9d7db --- 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,29 -291,10 +300,18 @@@ 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; ++ + ((void**)mapping_base)[0] = mapping_base; + ((void**)mapping_base)[1] = (void*)execute_ex; + ((char*)shared_segment->p) += ACCEL_BASE_POINTER_SIZE; - } + } - fprintf(fp, "%p\n", mapping_base); - fprintf(fp, "%p\n", execute_ex_base); - fclose(fp); - } shared_segment->pos = 0; shared_segment->size = requested_size;

« previous php.cvs (#112420) next »