Here is an experimental attempt to steal the SectorMemoryManager from https://github.com/llvm/llvm-project/pull/71968, rename it to SafeSectorMemoryManager, and inject it as shown in the previous patch. Another approach might be to try to make a new class that derives from SectorMemoryManager and adjusts minimal bits and pieces, but I figured it would be easier to diff against their code if we take the whole file. Hmm, I guess if "diff" convenience is the driving factor, it might be better to use a different namespace instead of a different name...
I am sure this requires changes for various LLVM versions. I tested it with LLVM 14 on a Mac where I've never managed to reproduce the original complaint, but ... ooooh, this might be exacerbated by ASLR, and macOS only has a small ALSR slide window (16M or 256M apparently, according to me in another thread), so I'd probably have to interpose my own mmap() to choose some more interesting addresses, or run some other OS, but that's quite enough rabbit holes for one morning.
v2-0001-XXX-LLVM-ARM-relocation-bug-mitigation.patch
Description: Binary data