Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bUJfe-0008CS-T9 for pgsql-hackers@arkaria.postgresql.org; Mon, 01 Aug 2016 20:18:43 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bUJfe-00047H-BY for pgsql-hackers@arkaria.postgresql.org; Mon, 01 Aug 2016 20:18:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bUJfd-00047A-Sj for pgsql-hackers@postgreSQL.org; Mon, 01 Aug 2016 20:18:41 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bUJfb-0000un-CO for pgsql-hackers@postgreSQL.org; Mon, 01 Aug 2016 20:18:41 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u71KIbGI014112 for ; Mon, 1 Aug 2016 16:18:37 -0400 From: Tom Lane To: pgsql-hackers@postgreSQL.org Subject: PostmasterContext survives into parallel workers!? Date: Mon, 01 Aug 2016 16:18:37 -0400 Message-ID: <14111.1470082717@sss.pgh.pa.us> X-Pg-Spam-Score: -2.2 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org 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? regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers