Join GitHub today
t/1-basic.t segfaults randomly if PCRE2 is compiled with --enable-jit-sealloc #29
I have PCRE2 10.30-RC1 built with --enable-jit-sealloc option. This option enabled an alternative JIT memory allocator based on mmaped temporary files. Running t/1-basic.t against such PCRE2 usually results to a segfault:
This is bacuse sljit_free_exec() does this assignment:
and the memory pointed by header is read-only at the moment.
A minimal reproducer is:
Removing any line (fork(), use Test::More; etc.) mitigates the crash. It's probably some kind of a race condition when the two processes deallocates the memory regions backed by the same file. But I don't understand how that could be possible.
I will forward it to PCRE2 authors as this is probably a PCRE2 bug. If you could reduce the reproducer to a pure PCRE2 C code, it would be great.