Suppress the following warning:
util-pages.c:49:13: warning: Both PROT_WRITE and PROT_EXEC flags are set. This can lead to exploitable memory regions, which could be overwritten with malicious code [security.MmapWriteExec]
49 | if (mprotect(ptr, getpagesize(), PROT_READ|PROT_WRITE|PROT_EXEC) == -1) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
As the check is done to check if the OS allows it or not, for enabling
JIT in pcre.
int PageSupportsRWX(void)
{
int retval = 1;
+ // suppress scan-build security.MmapWriteExec
+#ifndef __clang_analyzer__
void *ptr;
ptr = mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, -1, 0);
if (ptr != MAP_FAILED) {
}
munmap(ptr, getpagesize());
}
+#endif
return retval;
}
#endif /* HAVE_PAGESUPPORTSRWX_AS_MACRO */