From: Nikita Popov Date: Mon, 1 Jul 2019 08:37:34 +0000 (+0200) Subject: Msan: Unpoison getrandom() syscall result X-Git-Tag: php-7.4.0alpha3~103 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7e6db7006468483227ac04dc2f02feb349fab9e6;p=php Msan: Unpoison getrandom() syscall result --- diff --git a/ext/standard/random.c b/ext/standard/random.c index f6568a658f..82eee863e7 100644 --- a/ext/standard/random.c +++ b/ext/standard/random.c @@ -38,6 +38,10 @@ # endif #endif +#if __has_feature(memory_sanitizer) +# include +#endif + #ifdef ZTS int random_globals_id; #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; } #endif