Re: Shared buffer access rule violations?

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: Asim R P <apraveen(at)pivotal(dot)io>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Shared buffer access rule violations?
Date: 2018-08-08 02:00:27
Message-ID: CAH2-WzkPLgJq0h7Y8MjDh5A9T-V1zBAr0ZMQNPbXcKoRDhLfBQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Aug 7, 2018 at 6:43 PM, Asim R P <apraveen(at)pivotal(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2018-08-08 04:20:26 Why do we expand tuples in execMain.c?
Previous Message Asim R P 2018-08-08 01:43:57 Re: Shared buffer access rule violations?