Re: fork/exec patch: pre-CreateProcess finalization

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Jan Wieck <JanWieck(at)Yahoo(dot)com>, Claudio Natoli <claudio(dot)natoli(at)memetrics(dot)com>, "''pgsql-patches(at)postgresql(dot)org' '" <pgsql-patches(at)postgresql(dot)org>
Subject: Re: fork/exec patch: pre-CreateProcess finalization
Date: 2004-01-09 00:59:26
Message-ID: 18272.1073609966@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers-win32 pgsql-patches

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> When you say sub-postmaster, you mean we fork, then process the cancel
> request? Seems we might need special handling in there, yea.

We fork before we even read the request. Otherwise an attacker can
trivially lock up the postmaster by sending a partial startup packet.

I've just noticed another serious bit of breakage in CVS tip (though
this might be fixed by Claudio's pending patch that reverts a lot of
the code rearrangements). There is a reason why the 7.4 code does
on_exit_reset *immediately* after fork(), and it's not acceptable to
rearrange the code so that that happens at some random later time.
Otherwise, any problem in between leads to the child process executing
the postmaster's on_exit routines, with such pleasant side effects as
destroying the shmem segment. For similar reasons, you don't get to
postpone setting IsUnderPostmaster true --- elog pays attention to the
value of that flag, and will do the wrong thing if called in a child
process that doesn't yet have it set.

regards, tom lane

In response to

Browse pgsql-hackers-win32 by date

  From Date Subject
Next Message Bruce Momjian 2004-01-09 04:58:27 Re: [PATCHES] Proposed replacement for pipe under Win32
Previous Message Bruce Momjian 2004-01-09 00:49:18 Re: fork/exec patch: pre-CreateProcess finalization

Browse pgsql-patches by date

  From Date Subject
Next Message Claudio Natoli 2004-01-09 01:04:40 Re: fork/exec patch: pre-CreateProcess finalization
Previous Message Claudio Natoli 2004-01-09 00:57:59 Re: fork/exec patch: pre-CreateProcess finalization