| From: | Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> | 
|---|---|
| To: | Thomas Munro <thomas(dot)munro(at)gmail(dot)com> | 
| Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> | 
| Subject: | Re: using explicit_bzero | 
| Date: | 2019-07-05 13:07:31 | 
| Message-ID: | 09ed59aa-8ef0-3cc0-f812-0bf93e959f09@2ndquadrant.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
On 2019-07-05 14:06, Thomas Munro wrote:
> +#ifndef HAVE_EXPLICIT_BZERO
> +#define explicit_bzero(b, len) memset(b, 0, len)
> +#endif
> 
> I noticed some other libraries use memset through a function pointer
> or at least define a function the compiler can't see.
I don't understand what you are getting at here.
> The ssl tests fail:
> 
> FATAL:  could not load private key file "server-password.key": bad decrypt
> 
> That's apparently due to the passphrase being clobbered in the output
> buffer before we've managed to use it:
> 
> @@ -118,6 +118,7 @@ run_ssl_passphrase_command(const char *prompt,
> bool is_server_start, char *buf,
>                 buf[--len] = '\0';
> 
>  error:
> +       explicit_bzero(buf, size);
>         pfree(command.data);
>         return len;
>  }
Yeah, that's a silly mistake. New patch attached.
-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
| Attachment | Content-Type | Size | 
|---|---|---|
| v3-0001-Use-explicit_bzero.patch | text/plain | 5.0 KB | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Robert Haas | 2019-07-05 14:09:42 | Re: POC: Cleaning up orphaned files using undo logs | 
| Previous Message | Fabrízio de Royes Mello | 2019-07-05 12:52:15 | Re: Introduce MIN/MAX aggregate functions to pg_lsn |