summaryrefslogtreecommitdiff
path: root/ext/opcache/zend_file_cache.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-07-01 11:14:54 +0200
committerNikita Popov <nikita.ppv@gmail.com>2019-07-01 11:14:54 +0200
commit8fc58a1a1d32dd288bf4b9e09f9302a99d7b35fe (patch)
treeac8467b70f35a493c4362d7dcb1e2b1b87bb3181 /ext/opcache/zend_file_cache.c
parent4a8fe02c7c17d3d4427e9b0097ac72ed6bc163f7 (diff)
parent7defd5f69c7360ab1755f8a467972b3b012632c8 (diff)
downloadphp-git-8fc58a1a1d32dd288bf4b9e09f9302a99d7b35fe.tar.gz
Merge branch 'PHP-7.4'
Diffstat (limited to 'ext/opcache/zend_file_cache.c')
-rw-r--r--ext/opcache/zend_file_cache.c12
1 files changed, 12 insertions, 0 deletions
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);