Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hnsgE-0004vt-DI for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Jul 2019 22:45:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hnsgD-0001LB-7c for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Jul 2019 22:45:45 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1hnsgC-0001L4-V0 for pgsql-hackers@lists.postgresql.org; Wed, 17 Jul 2019 22:45:44 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hnsgA-00072R-UO for pgsql-hackers@postgresql.org; Wed, 17 Jul 2019 22:45:44 +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 x6HMjdNc025153; Wed, 17 Jul 2019 18:45:39 -0400 From: Tom Lane To: Alvaro Herrera cc: Thomas Munro , Peter Eisentraut , pgsql-hackers Subject: Re: using explicit_bzero In-reply-to: <20190717211931.GA906@alvherre.pgsql> References: <20190717211931.GA906@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Wed, 17 Jul 2019 17:19:31 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <25151.1563403539.1@sss.pgh.pa.us> Date: Wed, 17 Jul 2019 18:45:39 -0400 Message-ID: <25152.1563403539@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Alvaro Herrera writes: > On 2019-Jul-11, Thomas Munro wrote: >> Following a trail of crumbs beginning at OpenSSH's fallback >> implementation of this[1], I learned that C11 has standardised >> memset_s[2] for this purpose. Macs have memset_s but no >> explicit_bzero. FreeBSD has both. I wonder if it'd be better to make >> memset_s the function we use in our code, considering its standard >> blessing and therefore likelihood of being available on every system >> eventually. > Sounds like a future-proof way would be to implement memset_s in > src/port if absent from the OS (using explicit_bzero and other tricks), > and use that. +1 for using the C11-standard name, even if that's not anywhere in the real world yet. regards, tom lane