From: Nikita Popov Date: Mon, 11 May 2020 10:43:38 +0000 (+0200) Subject: Only use ifunc resolvers if __builtin_cpu_supports+init available X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b111674383fb638830193da672908a3abd5afe4e;p=php Only use ifunc resolvers if __builtin_cpu_supports+init available If either of them is not available, the use of zend_cpu_supports() inside ifunc resolvers may not be safe. --- diff --git a/Zend/zend_portability.h b/Zend/zend_portability.h index e1370eecf8..8a278c93f1 100644 --- a/Zend/zend_portability.h +++ b/Zend/zend_portability.h @@ -489,7 +489,10 @@ extern "C++" { # undef HAVE_FUNC_ATTRIBUTE_IFUNC #endif -#if defined(HAVE_FUNC_ATTRIBUTE_IFUNC) && defined(HAVE_FUNC_ATTRIBUTE_TARGET) +/* Only use ifunc resolvers if we have __builtin_cpu_supports() and __builtin_cpu_init(), + * otherwise the use of zend_cpu_supports() may not be safe inside ifunc resolvers. */ +#if defined(HAVE_FUNC_ATTRIBUTE_IFUNC) && defined(HAVE_FUNC_ATTRIBUTE_TARGET) && \ + defined(PHP_HAVE_BUILTIN_CPU_SUPPORTS) && defined(PHP_HAVE_BUILTIN_CPU_INIT) # define ZEND_INTRIN_HAVE_IFUNC_TARGET 1 #endif