Protecting allocator headers with Valgrind

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Richard Guo <guofenglinux(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Protecting allocator headers with Valgrind
Date: 2023-04-11 13:28:08
Message-ID: CAApHDvr=FZNGbj252Z6M9BSFKoq6BMxgkQ2yEAGUYoo7RquqZg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Over on [1], Tom mentioned that we might want to rethink the decision
to not protect chunk headers with Valgrind. That thread fixed a bug
that was accessing array element -1, which effectively was reading the
MemoryChunk at the start of the allocated chunk as an array element.

I wrote a patch to adjust the Valgrind macros to mark the MemoryChunks
as NOACCESS and that finds the bug reported on that thread (with the
fix for it reverted).

I didn't quite get a clear run at committing the changes during the
v16 cycle, but wondering since they're really just Valgrind macro
changes if anyone would object to doing it now?

I know there are a few people out there running sqlsmith and/or
sqlancer under Valgrind. It would be good to have this in so we could
address any new issues the attached patch might help them highlight.

Any objections?

(Copying in Tom and Richard same as original thread. Reposting for
more visibility of this change)

David

Attachment Content-Type Size
protect_MemoryChunks_with_Valgrind.patch application/octet-stream 19.5 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2023-04-11 13:37:40 Re: is_superuser is not documented
Previous Message Dave Page 2023-04-11 13:19:34 Re: When to drop src/tools/msvc support