Skip to content

Commit f8b217a

Browse files
kelunikcmb69
authored andcommitted
Fix pcre.jit on Apple Silicon
This backports zherczeg/sljit#105. Relates to bug #80435, however, it doesn't solve the bus error on PHP 8.0, but PHP 8.1 builds fine now. Closes phpGH-9279.
1 parent 65619e8 commit f8b217a

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ PHP NEWS
1818
. Fixed bug #77780 ("Headers already sent..." when previous connection was
1919
aborted). (Jakub Zelenka)
2020

21+
- PCRE:
22+
. Fixed pcre.jit on Apple Silicon. (Niklas Keller)
23+
2124
- Streams:
2225
. Fixed bug GH-9316 ($http_response_header is wrong for long status line).
2326
(cmb, timwolla)

ext/pcre/pcre2lib/sljit/sljitExecAllocator.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,13 @@ static SLJIT_INLINE void* alloc_chunk(sljit_uw size)
187187
if (retval == MAP_FAILED)
188188
return NULL;
189189

190+
#ifdef __FreeBSD__
191+
/* HardenedBSD's mmap lies, so check permissions again */
190192
if (mprotect(retval, size, PROT_READ | PROT_WRITE | PROT_EXEC) < 0) {
191193
munmap(retval, size);
192194
return NULL;
193195
}
196+
#endif /* FreeBSD */
194197

195198
SLJIT_UPDATE_WX_FLAGS(retval, (uint8_t *)retval + size, 0);
196199

0 commit comments

Comments
 (0)