Re: Segfault in jit tuple deforming on arm64 due to LLVM issue
Thomas Munro <thomas.munro@gmail.com>
From: Thomas Munro <thomas.munro@gmail.com>
To: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2024-08-26T23:32:25Z
Lists: pgsql-hackers
Attachments
- v2-0001-XXX-LLVM-ARM-relocation-bug-mitigation.patch (application/octet-stream) patch v2-0001
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.
Commits
-
Monkey-patch LLVM code to fix ARM relocation bug.
- 9044fc1d45a0 18.0 landed
- 50c1453a308d 12.21 landed
- e88d824a4127 13.17 landed
- 0b022ddf3e30 14.14 landed
- 19bf81c06a37 15.9 landed
- ee67b73f5902 16.5 landed
- b7467ab71c19 17.1 landed