com php-src: Merge branch 'PHP-7.4': ext/opcache/shared_alloc _win32.c
| From: | Christoph Michael Becker | Date: | Wed, 29 Jul 2020 11:38:53 +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-112433@lists.php.net to get a copy of this message | ||
Commit: da0f3279ea26ddb82c156600d43d4c9ab5893fa0
Author: Christoph M. Becker <cmbecker69@gmx.de> Wed, 29 Jul 2020 13:37:50 +0200
Parents: 687e14ddc220195390a68ce6ea43b0f55bad4aff 826b90a5f0ae355d93ba342419033e08aabc63b7
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=da0f3279ea26ddb82c156600d43d4c9ab5893fa0
Log:
Merge branch 'PHP-7.4'
* PHP-7.4:
Revert "Merge branch 'PHP-7.3' into PHP-7.4"
Changed paths:
MM ext/opcache/shared_alloc_win32.c
Diff:
diff --cc ext/opcache/shared_alloc_win32.c
index 337cf9d7db,d2c31dd63b..856e33696a
--- a/ext/opcache/shared_alloc_win32.c
+++ b/ext/opcache/shared_alloc_win32.c
@@@ -172,17 -206,8 +206,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 *) ((char*)mapping_base + ACCEL_BASE_POINTER_SIZE);
+ smm_shared_globals = (zend_smm_shared_globals *) mapping_base;
return SUCCESSFULLY_REATTACHED;
}
@@@ -300,18 -325,20 +334,29 @@@ static int create_segments(size_t reque
*error_in = "MapViewOfFile";
return ALLOC_FAILURE;
} else {
- char *mmap_base_file = get_mmap_base_file();
++ char *mmap_base_file;
+ void *execute_ex_base = (void *)execute_ex;
- FILE *fp = fopen(mmap_base_file, "w");
++ 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;
+ }
-
- ((void**)mapping_base)[0] = mapping_base;
- ((void**)mapping_base)[1] = (void*)execute_ex;
- ((char*)shared_segment->p) += ACCEL_BASE_POINTER_SIZE;
++ 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);
+ }
shared_segment->pos = 0;
shared_segment->size = requested_size;