Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fyjfy-00046l-NC for pgsql-bugs@arkaria.postgresql.org; Sat, 08 Sep 2018 20:17:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fyjfw-0003cV-DP for pgsql-bugs@arkaria.postgresql.org; Sat, 08 Sep 2018 20:17:48 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fyjfw-0003cO-3h for pgsql-bugs@lists.postgresql.org; Sat, 08 Sep 2018 20:17:48 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fyjfp-0001G5-8Y for pgsql-bugs@lists.postgresql.org; Sat, 08 Sep 2018 20:17:46 +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 w88KHdKZ007634; Sat, 8 Sep 2018 16:17:39 -0400 From: Tom Lane To: Michael Paquier cc: Andrew Gierth , Jeremy Evans , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15367: Crash in pg_fe_scram_free when using foreign tables In-reply-to: <20180908193914.GI32058@paquier.xyz> References: <20180906222843.GF17425@jeremyevans.local> <20180907165103.GH17425@jeremyevans.local> <20180907175518.GI17425@jeremyevans.local> <20180907181522.GB32058@paquier.xyz> <20016.1536351535@sss.pgh.pa.us> <20180907204403.GC32058@paquier.xyz> <16558.1536407783@sss.pgh.pa.us> <18398.1536410055@sss.pgh.pa.us> <87o9d8rv08.fsf@news-spur.riddles.org.uk> <3979.1536433320@sss.pgh.pa.us> <20180908193914.GI32058@paquier.xyz> Comments: In-reply-to Michael Paquier message dated "Sat, 08 Sep 2018 12:39:14 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <7632.1536437859.1@sss.pgh.pa.us> Date: Sat, 08 Sep 2018 16:17:39 -0400 Message-ID: <7633.1536437859@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Michael Paquier writes: > libpq is quite particular in the fact that it compiles directly with > stuff in src/common, src/port, etc. I think that the same problem > exists for pg_md5_encrypt(). So I like the solution proposed. I guess > you have made sure that postgres_fdw becomes stable this way? It still passes its regression test with the patch, on my OpenBSD image. See also the reproducer procedure I posted. The bigger issue we need to worry about is whether applying version-script symbol filtering would cause issues for third-party code that might be relying on being able to access libpq "internal" functions on *BSD. I don't have much sympathy for that and wouldn't hesitate to apply the filtering in HEAD and v11, but maybe in v10 we ought not do that. We could possibly band-aid around the problem in v10 by changing the SCRAM support functions so that they always malloc, never palloc, whether in frontend or not. That might lead to memory leaks in the backend case, but I'm not sure how much we care about memory leaks during backend authentication failures --- the process would exit shortly anyway. I've not investigated this idea any further than thinking of it, though, and I'm not sure it's worth the trouble to avoid symbol filtering. I'm inclined to add a test in src/test/authentication that exercises this problem, in hopes of finding out from the buildfarm whether we have any other platforms with the issue. regards, tom lane