3 ms·
This is not true. memset() can be optimized away, memset_s() cannot be optimized away by the compiler or the linker.
by benlarsen 4y ago
This is not true. memset() can be optimized away, memset_s() cannot be optimized away by the compiler or the linker.
- rurban 4y agobut the usual memset_s implementation does not flush the caches, only my safeclib implementation does so, crypto libs do not care.
- ncmncm 4y agoRight. In particular, a subsequent write to the same address may overwrite (part of) the cache line representing that bit of memory, pushing it to the back of the LRU line. This might happen over and over again, and that cache line then might not get flushed until the end of process's time slice. Anything out in memory backed by that cache line keeps its old value until the writeback finally happens.