Merge branch 'PHP-7.4'

This commit is contained in:
Nikita Popov 2019-07-01 11:14:54 +02:00
commit 8fc58a1a1d
4 changed files with 25 additions and 1 deletions

View file

@ -425,6 +425,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_chr, 0, 0, 1)
ZEND_ARG_INFO(0, encoding) ZEND_ARG_INFO(0, encoding)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
#if HAVE_MBREGEX
ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_regex_encoding, 0, 0, 0) ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_regex_encoding, 0, 0, 0)
ZEND_ARG_INFO(0, encoding) ZEND_ARG_INFO(0, encoding)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
@ -508,6 +509,7 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_regex_set_options, 0, 0, 0) ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_regex_set_options, 0, 0, 0)
ZEND_ARG_INFO(0, options) ZEND_ARG_INFO(0, options)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
#endif /* HAVE_MBREGEX */
/* }}} */ /* }}} */
/* {{{ zend_function_entry mbstring_functions[] */ /* {{{ zend_function_entry mbstring_functions[] */

View file

@ -572,7 +572,9 @@ static void zend_accel_class_hash_copy_from_shm(HashTable *target, HashTable *so
return; return;
} }
#if defined(__AVX__) #if __has_feature(memory_sanitizer)
# define fast_memcpy memcpy
#elif defined(__AVX__)
# include <nmmintrin.h> # include <nmmintrin.h>
# if defined(__GNUC__) && defined(__i386__) # if defined(__GNUC__) && defined(__i386__)
static zend_always_inline void fast_memcpy(void *dest, const void *src, size_t size) static zend_always_inline void fast_memcpy(void *dest, const void *src, size_t size)

View file

@ -49,6 +49,10 @@
# include <sys/file.h> # include <sys/file.h>
#endif #endif
#if __has_feature(memory_sanitizer)
# include <sanitizer/msan_interface.h>
#endif
#ifndef ZEND_WIN32 #ifndef ZEND_WIN32
#define zend_file_cache_unlink unlink #define zend_file_cache_unlink unlink
#define zend_file_cache_open open #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(ADLER32_INIT, buf, script->size);
info.checksum = zend_adler32(info.checksum, (signed char*)ZSTR_VAL((zend_string*)ZCG(mem)), info.str_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 #ifdef HAVE_SYS_UIO_H
vec[0].iov_base = &info; vec[0].iov_base = &info;
vec[0].iov_len = sizeof(info); vec[0].iov_len = sizeof(info);

View file

@ -38,6 +38,10 @@
# endif # endif
#endif #endif
#if __has_feature(memory_sanitizer)
# include <sanitizer/msan_interface.h>
#endif
#ifdef ZTS #ifdef ZTS
int random_globals_id; int random_globals_id;
#else #else
@ -133,6 +137,10 @@ PHPAPI int php_random_bytes(void *bytes, size_t size, zend_bool should_throw)
} }
} }
#if __has_feature(memory_sanitizer)
/* MSan does not instrument manual syscall invocations. */
__msan_unpoison(bytes + read_bytes, n);
#endif
read_bytes += (size_t) n; read_bytes += (size_t) n;
} }
#endif #endif