mirror of
https://github.com/php/php-src.git
synced 2024-09-21 09:57:23 +00:00
Fix asan false positive for mmap
For some reason, mmap regions which are repeatedly munmapped are not correctly unpoisoned. See https://github.com/google/sanitizers/issues/1705. Fixes GH-12756 Closes GH-12848
This commit is contained in:
parent
289073b452
commit
016c3861d7
@ -79,6 +79,9 @@
|
||||
#include <limits.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#ifdef __SANITIZE_ADDRESS__
|
||||
# include <sanitizer/asan_interface.h>
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
# include <sys/mman.h>
|
||||
@ -724,6 +727,9 @@ static void *zend_mm_chunk_alloc_int(size_t size, size_t alignment)
|
||||
if (zend_mm_use_huge_pages) {
|
||||
zend_mm_hugepage(ptr, size);
|
||||
}
|
||||
#ifdef __SANITIZE_ADDRESS__
|
||||
ASAN_UNPOISON_MEMORY_REGION(ptr, size);
|
||||
#endif
|
||||
return ptr;
|
||||
} else {
|
||||
size_t offset;
|
||||
@ -763,6 +769,9 @@ static void *zend_mm_chunk_alloc_int(size_t size, size_t alignment)
|
||||
if (zend_mm_use_huge_pages) {
|
||||
zend_mm_hugepage(ptr, size);
|
||||
}
|
||||
# ifdef __SANITIZE_ADDRESS__
|
||||
ASAN_UNPOISON_MEMORY_REGION(ptr, size);
|
||||
# endif
|
||||
#endif
|
||||
return ptr;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user