Re: PostmasterContext survives into parallel workers!?

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PostmasterContext survives into parallel workers!?
Date: 2016-08-01 22:09:03
Message-ID: CA+TgmoYZ7LB5erAQ7AbigruWhcHoqxhvfYOF1mVxU-XT7rs+FA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Aug 1, 2016 at 4:18 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> I noticed $subject while fooling around with the tqueue.c memory leak
> issues. This does not seem like a good idea to me. At the very least,
> it's a waste of space that could be used for something else, and at the
> worst, it might be a security issue because it leaves security-sensitive
> pg_hba and pg_ident information laying about in places where it might be
> recoverable (if only through memory-disclosure bugs, which we've had
> before and no doubt will have again).
>
> The reason is that the parallel worker launch path contains no equivalent
> of PostgresMain's stanza
>
> if (PostmasterContext)
> {
> MemoryContextDelete(PostmasterContext);
> PostmasterContext = NULL;
> }
>
> Now, I'm undecided whether to flush that context only in parallel workers,
> or to try to make it go away for all bgworkers of any stripe. The latter
> seems a little better from a security standpoint, but I wonder if anyone
> has a use-case where that'd be a bad idea?

I think it would be better to get rid of it in all bgworkers.

(Also vaguely on the list of things to clean up: can't we make it so
that bgworkers aren't launched from inside a signal handler? Blech.)

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2016-08-01 22:13:50 Re: TODO item: Implement Boyer-Moore searching in LIKE queries
Previous Message Tom Lane 2016-08-01 20:37:28 Re: HandleParallelMessages contains CHECK_FOR_INTERRUPTS?