[dm-crypt] unsafe??? use of memset
arno at wagner.name
Tue Dec 30 17:38:14 CET 2014
Interesting question. I think it is not relevant for most
Linux scenarios, as memset() comes precompiled as part of
a binary library, and the compiler has no clue what it
does and hence cannot optimize it away.
If memset is compiled together with the code using it,
this would be a problem, but also one anybody writing
secure code should be aware of. I am not aware of any
normal Linux scenarios where that could happen.
Still, soemthing low-priority to fix eventually, as
it cannot be ruled out that it may some day be compiled
in a dangerous fashion or memset() may be made a macro
or some other bizarre circumstances.
BTW, with GCC, there is also the possibility to locally
prohibit optimization with something like:
#pragma GCC push_options
#pragma GCC optimize ("O0")
#pragma GCC pop_options
I needed that some time ago, but do not remember for what.
Anyways, this is an area where recipes do not cut it. For
secure code you have to understand how it gets compiled
on the specific target platform and what the issues there
On Tue, Dec 30, 2014 at 14:57:56 CET, .. ink .. wrote:
> a lot of people like this one advises against the use of memset to clear
> memory but crypsetup seems to
> ignore this advice and use memset a lot like in.
> Any reason why cryptseup is ignoring this advice?
> dm-crypt mailing list
> dm-crypt at saout.de
Arno Wagner, Dr. sc. techn., Dipl. Inform., Email: arno at wagner.name
GnuPG: ID: CB5D9718 FP: 12D6 C03B 1B30 33BB 13CF B774 E35C 5FA1 CB5D 9718
A good decision is based on knowledge and not on numbers. -- Plato
If it's in the news, don't worry about it. The very definition of
"news" is "something that hardly ever happens." -- Bruce Schneier
More information about the dm-crypt