[RFC] [PATCH] Support explicit_bzero, memset_s, memzero_explicit, or similar.

Paul Eggert eggert@cs.ucla.edu
Tue Dec 23 02:21:00 GMT 2014


Nick Mathewson wrote:
> For example, see the memset calls at the end of:
>       __md5_crypt_r
>       __sha256_crypt_r
>       __sha512_crypt_r
>
> The documented intent there is to clear data from the stack before
> returning, but the compiler is free to remove them IIUC.

Yes, that sounds like it could be a problem.  Have you inspected the generated 
code to see whether the problem actually occurs?  That would strengthen the case 
for a buffer-smushing primitive, even if it's only internal to glibc.  (I still 
see no reason for guaranteeing that any such primitive sets the buffer's bytes 
to zero -- any value will do so long as it's independent of the buffer's 
previous contents.)



More information about the Libc-alpha mailing list