summaryrefslogtreecommitdiff
path: root/ext/opcache
diff options
context:
space:
mode:
Diffstat (limited to 'ext/opcache')
-rw-r--r--ext/opcache/zend_accelerator_util_funcs.c4
-rw-r--r--ext/opcache/zend_file_cache.c12
2 files changed, 15 insertions, 1 deletions
diff --git a/ext/opcache/zend_accelerator_util_funcs.c b/ext/opcache/zend_accelerator_util_funcs.c
index 9692b4023c..be927f6447 100644
--- a/ext/opcache/zend_accelerator_util_funcs.c
+++ b/ext/opcache/zend_accelerator_util_funcs.c
@@ -572,7 +572,9 @@ static void zend_accel_class_hash_copy_from_shm(HashTable *target, HashTable *so
return;
}
-#if defined(__AVX__)
+#if __has_feature(memory_sanitizer)
+# define fast_memcpy memcpy
+#elif defined(__AVX__)
# include <nmmintrin.h>
# if defined(__GNUC__) && defined(__i386__)
static zend_always_inline void fast_memcpy(void *dest, const void *src, size_t size)
diff --git a/ext/opcache/zend_file_cache.c b/ext/opcache/zend_file_cache.c
index 4079c8bf1c..caff6ec1ce 100644
--- a/ext/opcache/zend_file_cache.c
+++ b/ext/opcache/zend_file_cache.c
@@ -49,6 +49,10 @@
# include <sys/file.h>
#endif
+#if __has_feature(memory_sanitizer)
+# include <sanitizer/msan_interface.h>
+#endif
+
#ifndef ZEND_WIN32
#define zend_file_cache_unlink unlink
#define zend_file_cache_open open
@@ -954,6 +958,14 @@ int zend_file_cache_script_store(zend_persistent_script *script, int in_shm)
info.checksum = zend_adler32(ADLER32_INIT, buf, script->size);
info.checksum = zend_adler32(info.checksum, (signed char*)ZSTR_VAL((zend_string*)ZCG(mem)), info.str_size);
+#if __has_feature(memory_sanitizer)
+ /* The buffer may contain uninitialized regions. However, the uninitialized parts will not be
+ * used when reading the cache. We should probably still try to get things fully initialized
+ * for reproducibility, but for now ignore this issue. */
+ __msan_unpoison(&info, sizeof(info));
+ __msan_unpoison(buf, script->size);
+#endif
+
#ifdef HAVE_SYS_UIO_H
vec[0].iov_base = &info;
vec[0].iov_len = sizeof(info);