From: ilmari@ilmari.org
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: using explicit_bzero
Date: Fri, 21 Jun 2019 14:45:47 +0100
Message-ID: <d8jv9wzvypg.fsf@dalvik.ping.uio.no> (raw)
In-Reply-To: <27860.1561123531@sss.pgh.pa.us>
References: <42d26bde-5d5b-c90d-87ae-6cab875f73be@2ndquadrant.com>
<27860.1561123531@sss.pgh.pa.us>
Tom Lane <tgl@sss.pgh.pa.us> writes:
> Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
>> +#ifndef HAVE_EXPLICIT_BZERO
>> +#define explicit_bzero(b, len) bzero(b, len)
>> +#endif
>
> This presumes that every platform has bzero, which is unsafe (POSIX
> doesn't specify it) and is an assumption we kicked to the curb a dozen
> years ago (067a5cdb3). Please use memset() for the substitute instead.
>
> Also, I'm a bit suspicious of using AC_CHECK_FUNCS for this; that
> generally Doesn't Work for anything that's not a vanilla out-of-line
> function. Are we worried about people implementing this as a macro,
> compiler built-in, etc?
Also, on Linux it requires libbsd: https://libbsd.freedesktop.org/
(which seems to be down, but
https://packages.debian.org/buster/libbsd-dev has a list of the
functions it provides).
- ilmari
--
"A disappointingly low fraction of the human race is,
at any given time, on fire." - Stig Sandbeck Mathisen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: ilmari@ilmari.org, tgl@sss.pgh.pa.us, peter.eisentraut@2ndquadrant.com
Subject: Re: using explicit_bzero
In-Reply-To: <d8jv9wzvypg.fsf@dalvik.ping.uio.no>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox