diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-07-01 11:02:31 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-07-01 11:14:28 +0200 |
commit | da06f7f383e2b54094975b3b49fd05076191976e (patch) | |
tree | 3c550c05ad4fcddd975cde8c2d154028857e7a60 /ext/opcache/zend_file_cache.c | |
parent | c8af6a7fa70c0722e1a87d48d69e236f4ed7b0e5 (diff) | |
download | php-git-da06f7f383e2b54094975b3b49fd05076191976e.tar.gz |
Msan: Unpoison buffer written by file cache
It would be great if this were fully initialized, but it's not
really a problem either (as long as we don't care about reproducible
file cache), so ignore this for now.
Diffstat (limited to 'ext/opcache/zend_file_cache.c')
-rw-r--r-- | ext/opcache/zend_file_cache.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/ext/opcache/zend_file_cache.c b/ext/opcache/zend_file_cache.c index 31f7e20cd6..2c6c16002e 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 @@ -947,6 +951,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); |