LLVM's UBSAN (version 17) started using bytes below a function as
metadata for the sanitizer. It adds code to read this metadata when
performing an indirect function call, which means that if the function
itself is placed at a beginning of a mapped page, the application would
crash, because the previous page doesn't have to be accessible.
Unfortunately, LLVM exposes users to this implementation detail now,
and to make it possible to instrument software that links to asmjit,
a workaround had to be added. In addition, it's not just possible to
add this workaround to UBSAN builds, because asmjit can be installed
via a package and third party code that uses UBSAN can just link to
it. This means that we have to add padding to each block that provides
consecutive memory.
This behavior is now the default, however, an option exist:
asmjit::JitAllocatorOptions::kDisableInitialPadding
With this option it's possible to control the behavior and to disable
the artificial padding used as a workaround.
Fixed MSVC AArch64 build
* Detect AArch64 target properly when compiling by MSVC
* Workaround the issue caused by MSVC defining a mvn macro
---------
Co-authored-by: Petr Kobalicek <kobalicek.petr@gmail.com>
The helper functions for the tests were referencing functions which do not exist if AsmJit is built using `ASMJIT_NO_INTROSPECTION`. This commit fixes the issue by moving the helper function inside the preprocessor `if` used for the test cases.
* Refactored workflows to use a single workflow for both VM and non-VM builds
* Compiler tests are now able to test compilation of different architectures
Changes related to VirtMem
* Moved memory mapping code to mapMemory() and unmapMemory() helper functions
* Added MemoryFlags::kMapShared to optionally allow MAP_SHARED when necessary
* Clarified that MAP_SHARED is used by dual mapping by default
* Extends MemoryFlags::kMMapMax... to use PROT_MPROTECT on NetBSD
* Changed NetBSD dual mapping code to use MAP_SHARED to avoid COW
Changes related to JitAllocator
* Propagate error from VirtMem (not just OOM) when VirtMem allocation failed
* Added more tests to verify that RW + RX regions share the same content
In addition, always enable DualMapping when RWX pages are not
possible to allocate in JitAllocator, because otherwise the
allocator would not be able to allocate memory for JIT code
execution.
New CI runners to test FreeBSD, NetBSD, and OpenBSD are also
provided.