Re: Shared buffer access rule violations? - Mailing list pgsql-hackers

From Peter Geoghegan
Subject Re: Shared buffer access rule violations?
Date
Msg-id CAH2-WzkPLgJq0h7Y8MjDh5A9T-V1zBAr0ZMQNPbXcKoRDhLfBQ@mail.gmail.com
Whole thread Raw
In response to Re: Shared buffer access rule violations?  (Asim R P <apraveen@pivotal.io>)
Responses Re: Shared buffer access rule violations?
List pgsql-hackers
On Tue, Aug 7, 2018 at 6:43 PM, Asim R P <apraveen@pivotal.io> wrote:
> Please find attached a patch to mark a shared buffer as read-write or
> read-only using mprotect().  The idea is to catch violations of shared
> buffer access rules.  This patch was useful to detect the access
> violations reported in this thread.  The mprotect() calls are enabled
> by -DMPROTECT_BUFFER compile time flag.

I wonder if it would be a better idea to enable Valgrind's memcheck to
mark buffers as read-only or read-write. We've considered doing
something like that for years, but for whatever reason nobody followed
through.

Using Valgrind would have the advantage of making it possible to mark
memory as undefined or as noaccess. I can imagine doing even fancier
things by making that distinction within buffers. For example, marking
the hole in the middle of a page/buffer as undefined, while still
marking the entire buffer noaccess when there is no pin held.

-- 
Peter Geoghegan


pgsql-hackers by date:

Previous
From: Asim R P
Date:
Subject: Re: Shared buffer access rule violations?
Next
From: Andres Freund
Date:
Subject: Why do we expand tuples in execMain.c?