Peter Geoghegan wrote:
> On Sat, Jun 6, 2015 at 12:58 PM, Noah Misch <[email protected]> wrote:
> > - Call VALGRIND_MAKE_MEM_NOACCESS() on a shared buffer when its local pin
> > count falls to zero. Under CLOBBER_FREED_MEMORY, wipe a shared buffer
> > when its global pin count falls to zero.
>
> Did a patch for this ever materialize?
I think the first part would be something like the attached.
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
index e4b25587..83fde10 100644
--- a/src/backend/storage/buffer/bufmgr.c
+++ b/src/backend/storage/buffer/bufmgr.c
@@ -47,6 +47,7 @@
#include "storage/proc.h"
#include "storage/smgr.h"
#include "storage/standby.h"
+#include "utils/memdebug.h"
#include "utils/rel.h"
#include "utils/resowner_private.h"
#include "utils/timestamp.h"
@@ -1438,6 +1439,9 @@ PinBuffer(volatile BufferDesc *buf, BufferAccessStrategy strategy)
ref = NewPrivateRefCountEntry(b + 1);
LockBufHdr(buf);
+
+ VALGRIND_MAKE_MEM_DEFINED(BufHdrGetBlock(buf), BLCKSZ);
+
buf->refcount++;
if (strategy == NULL)
{
@@ -1498,6 +1502,8 @@ PinBuffer_Locked(volatile BufferDesc *buf)
*/
Assert(GetPrivateRefCountEntry(b + 1, false) == NULL);
+ VALGRIND_MAKE_MEM_DEFINED(BufHdrGetBlock(buf), BLCKSZ);
+
buf->refcount++;
UnlockBufHdr(buf);
@@ -1543,6 +1549,8 @@ UnpinBuffer(volatile BufferDesc *buf, bool fixOwner)
Assert(buf->refcount > 0);
buf->refcount--;
+ VALGRIND_MAKE_MEM_NOACCESS(BufHdrGetBlock(buf), BLCKSZ);
+
/* Support LockBufferForCleanup() */
if ((buf->flags & BM_PIN_COUNT_WAITER) &&
buf->refcount == 1)
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers