mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Fix MSan false-positive in zend_max_execution_timer (#15408)
Explicitly mark memory regions as unpoisoned for zend_max_execution_timer on ZTS, as MemorySanitizer in clang >= 18 causes false positives.
This commit is contained in:
parent
8c3f5f99f3
commit
ec9cdcd2bc
1 changed files with 10 additions and 0 deletions
|
@ -24,6 +24,10 @@
|
|||
#include <sys/syscall.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#if __has_feature(memory_sanitizer)
|
||||
# include <sanitizer/msan_interface.h>
|
||||
#endif
|
||||
|
||||
#include "zend.h"
|
||||
#include "zend_globals.h"
|
||||
|
||||
|
@ -47,6 +51,12 @@ ZEND_API void zend_max_execution_timer_init(void) /* {{{ */
|
|||
sev.sigev_signo = SIGRTMIN;
|
||||
sev.sigev_notify_thread_id = (pid_t) syscall(SYS_gettid);
|
||||
|
||||
#if __has_feature(memory_sanitizer)
|
||||
/* MSan does not intercept timer_create() */
|
||||
__msan_unpoison(&EG(max_execution_timer_timer),
|
||||
sizeof(EG(max_execution_timer_timer)));
|
||||
#endif
|
||||
|
||||
// Measure wall time instead of CPU time as originally planned now that it is possible https://github.com/php/php-src/pull/6504#issuecomment-1370303727
|
||||
if (timer_create(CLOCK_BOOTTIME, &sev, &EG(max_execution_timer_timer)) != 0) {
|
||||
zend_strerror_noreturn(E_ERROR, errno, "Could not create timer");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue