From: Arno Wagner <arno@wagner.name>
To: dm-crypt@saout.de
Subject: Re: [dm-crypt] unsafe??? use of memset
Date: Tue, 30 Dec 2014 17:38:14 +0100 [thread overview]
Message-ID: <20141230163814.GA18851@tansi.org> (raw)
In-Reply-To: <CAFnMBaQZp63DCZB9f9K1tPia237OGWjVQ6c2oYM7VNSDWqk_Vw@mail.gmail.com>
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")
code
#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
are.
Arno
On Tue, Dec 30, 2014 at 14:57:56 CET, .. ink .. wrote:
> a lot of people like this one[2] advises against the use of memset to clear
> memory but crypsetup seems to
> ignore this advice and use memset a lot like in[1].
>
> Any reason why cryptseup is ignoring this advice?
>
> [1]
> https://code.google.com/p/cryptsetup/source/browse/lib/tcrypt/tcrypt.c#272
> [2]
> http://edc.tversu.ru/elib/inf/0088/0596003943_secureprgckbk-chp-13-sect-2.html
> _______________________________________________
> dm-crypt mailing list
> dm-crypt@saout.de
> http://www.saout.de/mailman/listinfo/dm-crypt
--
Arno Wagner, Dr. sc. techn., Dipl. Inform., Email: arno@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
prev parent reply other threads:[~2014-12-30 16:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-30 13:57 [dm-crypt] unsafe??? use of memset .. ink ..
2014-12-30 14:26 ` Milan Broz
2014-12-30 16:47 ` Arno Wagner
2014-12-30 16:38 ` Arno Wagner [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141230163814.GA18851@tansi.org \
--to=arno@wagner.name \
--cc=dm-crypt@saout.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.