Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d8443b5f-71c3-fdfe-8df8-38dd0efd41db@oracle.com>
Date: Mon, 4 Oct 2021 18:22:39 -0700
From: Alan Coopersmith <alan.coopersmith@...cle.com>
To: Paul Eggert <eggert@...ucla.edu>,
        Konstantin Belousov <kostikbel@...il.com>
Cc: libc-coord@...ts.openwall.com, Keith Packard <keithp@...thp.com>
Subject: Re: freezero() and freezeroall()

On 9/17/21 5:46 PM, Paul Eggert wrote:
> Looking at the current OpenBSD source code[1], it appears they're doing best 
> effort. Unless I'm missing something, in some cases freezero appears to call 
> memset instead of explicit_bzero. Even if that were changed, on real systems I 
> expect the data are too often still lying around somewhere in the hardware. I 
> suppose the idea is that it's better than nothing.

I believe the goal is to protect against the memory being visible in core files
and to debuggers, not to a physical RAM dump of some sort.

> With all this in mind it would be better to add a better API, as Alan proposed, 
> than to standardize on freezero. The name 'freezeroall' is a bit hard to read, 
> though - how about calling it 'clearfree' instead? ("clear" before "free" 
> because that's the order it's conceptually done.)

I picked freezeroall() to follow on from the existing and already spreading
freezero(), but if there's a different name that other libc implementations
would like to standardize on and adopt, I'm open to using that instead.

While cfree() to mirror calloc() is tempting, history already claimed that
name and it's best not to re-use:
https://man7.org/linux/man-pages/man3/cfree.3.html

C23 seems to be using the convention that alternatives to free() still
start with the "free_" prefix:
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2801.htm
(as discussed on this list back in February in the thread
  "Sized deallocation for C" archived on
  https://www.openwall.com/lists/libc-coord/2021/02/ )

-- 
	-Alan Coopersmith-               alan.coopersmith@...cle.com
	 Oracle Solaris Engineering - https://blogs.oracle.com/alanc

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.