On Tue, Aug 27, 2024 at 2:16 AM Anthonin Bonnefoy
<anthonin(dot)bonnefoy(at)datadoghq(dot)com> wrote:
> There's a possible alternative, but it's definitely in the same
> category as the hot-patching idea. llvmjit uses
> LLVMOrcCreateRTDyldObjectLinkingLayerWithSectionMemoryManager to
> create the ObjectLinkingLayer and it will be created with the default
> SectionMemoryManager[2]. It should be possible to provide a modified
> SectionMemoryManager with the change to allocate sections in a single
> block and it could be restricted to arm64 architecture. A part of me
> tells me this is probably a bad idea but on the other hand, LLVM
> provides this way to plug a custom allocator and it would fix the
> issue...
Interesting. Here is a quick hack to experiment with injecting a new
memory manager. This one just wraps the normal one and logs the
addresses it allocates, but from here, you're right, we could try to
constraint its address range somehow (or perhaps just check its range
and fail gracefully).