Skip to content

Fix asan false positive for mmap #12848

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Zend/zend_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down