Re: using explicit_bzero

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Thomas Munro <thomas.munro@gmail.com>, Peter Eisentraut <peter.eisentraut@2ndquadrant.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2019-07-17T22:45:39Z
Lists: pgsql-hackers
Alvaro Herrera <alvherre@2ndquadrant.com> 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



Commits

  1. Use explicit_bzero