Re: Make memory checking / sanitizing infrastructure better

Jacob Champion <jacob.champion@enterprisedb.com>

From: Jacob Champion <jacob.champion@enterprisedb.com>
To: Andres Freund <andres@anarazel.de>
Cc: pgsql-hackers@postgresql.org
Date: 2026-05-28T17:29:50Z
Lists: pgsql-hackers
On Thu, May 28, 2026 at 9:07 AM Andres Freund <andres@anarazel.de> wrote:
> 4) For this I prototyped making the valgrind annotations more generic and
>    using the address sanitizer interface to mark memory as poisoned /
>    unpoisoned.  That doesn't provide quite all the checking that valgrind can
>    do (it doesn't track uninitialized memory), but it's considerably better
>    than our memory context checking, and *much* *much* faster than valgrind.

Neat! I was recently hoping for this in [1].

> I have prototype patches for 1-4, but wanted to hear about whether such
> changes sound sane to others, before spending time to polish all of this up.

They all sound like nice improvements to me. I like the idea in (5), too.

--Jacob

[1] https://postgr.es/m/CAOYmi%2BnCg5upBVOo_UCSjMfO%3DYMkZXcSEsgaADKXqerr5wahZQ%40mail.gmail.com