Zero an mpz_t?

David Gillies daggillies at gmail.com
Tue Dec 20 08:42:04 CET 2011


On Tue, Dec 20, 2011 at 12:47 AM,  <bodrato at mail.dm.unipi.it> wrote:
> Ciao,
>
> Il Lun, 19 Dicembre 2011 11:38 pm, David Gillies ha scritto:
>> out to swap. I'm not sure if you want to go the extra paranoid step
>> and make sure L2 cache is flushed prior to unlocking pages.
>
> Well, if you overwrite the buffer with all zeros, before deallocate (as
> the subject of this thread suggests), you probably don't need this further
> step, right? ;-)
>

_probably_ not. The act of writing zeros to the buffer should dirty
the cache line and cause a flush. But if a page is freed before a
cache flush occurs, who knows? An 'efficient' memory manager may forgo
the flush since the cache line in question is no longer mapped to an
allocated page. The semantics of memory visibility are complex,
architecture-dependent and potential causes of leaky cryptosystems.
This problem becomes especially salient now we are in the era of
multi-core CPUs as standard. There's also usually no cache-control
functionality visible from user space (you can do some interesting
things with device drivers here).

-- 
David Gillies
San Jose
Costa Rica


More information about the gmp-discuss mailing list