[pcre-dev] [Bug 2618] JIT crash in macOS 11 with ARM64 hardw…

Pàgina inicial
Delete this message
Autor: admin
Data:  
A: pcre-dev
Assumptes vells: [pcre-dev] [Bug 2618] New: Patch with JIT support for macOS ARM64 hardware
Assumpte: [pcre-dev] [Bug 2618] JIT crash in macOS 11 with ARM64 hardware
https://bugs.exim.org/show_bug.cgi?id=2618

--- Comment #18 from Saagar Jha <saagar@???> ---
(In reply to Carlo Marcelo Arenas Belón from comment #17)
> does this mean than applying the patch from Bug 2626 "solves" the issue?
>
> note that you will need to also configure it with an additional setting to
> enable the pre-alpha W^X compatible internal allocator and would obviously
> not work if MAP_JIT was required.


I believe so, although you will need entitlements to allow unsigned code under
the Hardened Runtime.

> regardless if it works, the solution by Stuart should be the only one that
> should be added (once completed) in anything for mass production.


Yes, this is what I'd suggest too.

> both sljit and pcre (as libraries) can be built statically and therefore
> pthread.h might not be included; therefore build/configuration will need to
> be updated.


When I say this is difficult to do accidentally, I meant it. When you are
linking "statically" on macOS you are still linking against libSystem. The only
way to make a truly statically linked binary is to give up even the C runtime
and make raw system calls yourself, which are not supported by Apple and a bad
idea in general because they often change between even the most minor versions
of macOS.

> so this means that it should be #ifdef out to prevent build issues or all is
> needed (unless your compiler is not clang from XCode) is the magic:
>
> if (__builtin_available(macOS 11, *)
>
> thanks for your explanations, and sorry if being slightly off-topic


No, I'm happy to help. The TL;DR is, on macOS running on Apple silicon (11+ by
definition) you will need the call. On Big Sur running on Intel the call is
optional (does nothing) but the symbol is available. On iOS it is not available
at all because there is no JIT so it couldn't possibly do anything. On pre-Big
Sur (Intel) it is not available at all as well, nor will it be on non-Apple
platforms.

Code-wise, I think you should probably use standard preprocessor macros if you
want to be portable; probably __APPLE__ and one of the version checks so that
it works on compilers that don't understand that builtin.

--
You are receiving this mail because:
You are on the CC list for the bug.