pgsql: Map and unmap the shared memory block before risking VirtualFree

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Map and unmap the shared memory block before risking VirtualFree
Date: 2018-04-30 21:07:19
Message-ID: E1fDG11-00024u-E1@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Map and unmap the shared memory block before risking VirtualFree.

The idea here is to get Windows' userspace infrastructure to allocate
whatever space it needs for MapViewOfFileEx() before we release the
locked-down space that we want to map the shared memory block into.

This is a fairly brute-force attempt, and would likely (for example)
fail with large shared memory on 32-bit Windows. We could perhaps
ameliorate that by mapping only part of the shared memory block in
this way, but for the moment I just want to see if this approach
will fix dory's problem.

Discussion: https://postgr.es/m/25495.1524517820@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/73042b8d136fe985746dc762fcb2a4356460842d

Modified Files
--------------
src/backend/port/win32_shmem.c | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2018-04-30 23:37:18 Re: pgsql: Prevent infinity and NaN in jsonb/plperl transform
Previous Message Tom Lane 2018-04-30 20:19:56 pgsql: Further effort at preventing memory map dump from affecting the