Re: Segfault in jit tuple deforming on arm64 due to LLVM issue

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Anthonin Bonnefoy <anthonin(dot)bonnefoy(at)datadoghq(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Segfault in jit tuple deforming on arm64 due to LLVM issue
Date: 2024-08-26 23:32:25
Message-ID: CA+hUKGKgBs1C-TWJ_FY3H4tFMi8Cqot2ufU=7afV8MKDuQ6k2w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

Attachment Content-Type Size
v2-0001-XXX-LLVM-ARM-relocation-bug-mitigation.patch application/octet-stream 29.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2024-08-26 23:34:46 Re: Segfault in jit tuple deforming on arm64 due to LLVM issue
Previous Message Jacob Champion 2024-08-26 23:23:06 Re: [PoC] Federated Authn/z with OAUTHBEARER