Re: [BUG/PATCH] kernel RNG and its secrets

2015-04-27 Thread Stephan Mueller
Am Montag, 27. April 2015, 22:34:30 schrieb Daniel Borkmann: Hi Daniel, On 04/27/2015 09:10 PM, Stephan Mueller wrote: ... I posted the issue on the clang mailing list on April 10 -- no word so far. I would interpret this as a sign that it is a no-issue for them. Hm. ;) Here's a

Re: [BUG/PATCH] kernel RNG and its secrets

2015-04-27 Thread Daniel Borkmann
On 04/27/2015 10:41 PM, Stephan Mueller wrote: ... It seems you have the code already in mind, so please if you could write it :-) Ok, sure. I'll cook something by tomorrow morning. Cheers, Daniel -- To unsubscribe from this list: send the line unsubscribe linux-crypto in the body of a

Re: [BUG/PATCH] kernel RNG and its secrets

2015-04-27 Thread Daniel Borkmann
On 04/27/2015 09:10 PM, Stephan Mueller wrote: ... I posted the issue on the clang mailing list on April 10 -- no word so far. I would interpret this as a sign that it is a no-issue for them. Hm. ;) Here's a bug report on the topic, gcc vs llvm: https://llvm.org/bugs/show_bug.cgi?id=15495

Re: [BUG/PATCH] kernel RNG and its secrets

2015-04-27 Thread Stephan Mueller
Am Freitag, 10. April 2015, 16:50:22 schrieb Stephan Mueller: Hi Stephan, Am Freitag, 10. April 2015, 16:46:04 schrieb Daniel Borkmann: Hi Daniel, On 04/10/2015 04:36 PM, Stephan Mueller wrote: Am Freitag, 10. April 2015, 16:26:00 schrieb Hannes Frederic Sowa: ... I suspected a problem in

Re: [BUG/PATCH] kernel RNG and its secrets

2015-04-10 Thread mancha security
On Fri, Apr 10, 2015 at 04:33:17PM +0200, Stephan Mueller wrote: Am Freitag, 10. April 2015, 14:22:08 schrieb mancha security: Hi mancha, __asm__ __volatile__(: :r(p) :memory) gcc -O2/3: mov present clang -O2/3: mov present == approach would be good too. Note, the assembly code

Re: [BUG/PATCH] kernel RNG and its secrets

2015-03-18 Thread Daniel Borkmann
[ Cc'ing Cesar ] On 03/18/2015 10:53 AM, mancha wrote: Hi. The kernel RNG introduced memzero_explicit in d4c5efdb9777 to protect memory cleansing against things like dead store optimization: void memzero_explicit(void *s, size_t count) { memset(s, 0, count);

Re: [BUG/PATCH] kernel RNG and its secrets

2015-03-18 Thread Hannes Frederic Sowa
On Wed, Mar 18, 2015, at 10:53, mancha wrote: Hi. The kernel RNG introduced memzero_explicit in d4c5efdb9777 to protect memory cleansing against things like dead store optimization: void memzero_explicit(void *s, size_t count) { memset(s, 0, count);

[BUG/PATCH] kernel RNG and its secrets

2015-03-18 Thread mancha
Hi. The kernel RNG introduced memzero_explicit in d4c5efdb9777 to protect memory cleansing against things like dead store optimization: void memzero_explicit(void *s, size_t count) { memset(s, 0, count); OPTIMIZER_HIDE_VAR(s); } OPTIMIZER_HIDE_VAR, introduced in

Re: [BUG/PATCH] kernel RNG and its secrets

2015-03-18 Thread Daniel Borkmann
On 03/18/2015 11:50 AM, Hannes Frederic Sowa wrote: On Wed, Mar 18, 2015, at 10:53, mancha wrote: Hi. The kernel RNG introduced memzero_explicit in d4c5efdb9777 to protect memory cleansing against things like dead store optimization: void memzero_explicit(void *s, size_t count) {

Re: [BUG/PATCH] kernel RNG and its secrets

2015-03-18 Thread Stephan Mueller
Am Mittwoch, 18. März 2015, 11:56:43 schrieb Daniel Borkmann: Hi Daniel, On 03/18/2015 11:50 AM, Hannes Frederic Sowa wrote: On Wed, Mar 18, 2015, at 10:53, mancha wrote: Hi. The kernel RNG introduced memzero_explicit in d4c5efdb9777 to protect memory cleansing against things like dead

Re: [BUG/PATCH] kernel RNG and its secrets

2015-03-18 Thread Stephan Mueller
Am Mittwoch, 18. März 2015, 13:02:12 schrieb Hannes Frederic Sowa: Hi Hannes, On Wed, Mar 18, 2015, at 12:09, Stephan Mueller wrote: Am Mittwoch, 18. März 2015, 11:56:43 schrieb Daniel Borkmann: On 03/18/2015 11:50 AM, Hannes Frederic Sowa wrote: On Wed, Mar 18, 2015, at 10:53, mancha wrote:

Re: [BUG/PATCH] kernel RNG and its secrets

2015-03-18 Thread Hannes Frederic Sowa
On Wed, Mar 18, 2015, at 12:09, Stephan Mueller wrote: Am Mittwoch, 18. März 2015, 11:56:43 schrieb Daniel Borkmann: On 03/18/2015 11:50 AM, Hannes Frederic Sowa wrote: On Wed, Mar 18, 2015, at 10:53, mancha wrote: Hi. The kernel RNG introduced memzero_explicit in d4c5efdb9777 to

Re: [BUG/PATCH] kernel RNG and its secrets

2015-03-18 Thread Hannes Frederic Sowa
On Wed, Mar 18, 2015, at 13:14, Stephan Mueller wrote: Am Mittwoch, 18. März 2015, 13:02:12 schrieb Hannes Frederic Sowa: Hi Hannes, On Wed, Mar 18, 2015, at 12:09, Stephan Mueller wrote: Am Mittwoch, 18. März 2015, 11:56:43 schrieb Daniel Borkmann: On 03/18/2015 11:50 AM, Hannes

Re: [BUG/PATCH] kernel RNG and its secrets

2015-03-18 Thread mancha
On Wed, Mar 18, 2015 at 01:02:12PM +0100, Hannes Frederic Sowa wrote: On Wed, Mar 18, 2015, at 12:09, Stephan Mueller wrote: Am Mittwoch, 18. März 2015, 11:56:43 schrieb Daniel Borkmann: On 03/18/2015 11:50 AM, Hannes Frederic Sowa wrote: On Wed, Mar 18, 2015, at 10:53, mancha wrote:

Re: [BUG/PATCH] kernel RNG and its secrets

2015-03-18 Thread Stephan Mueller
Am Mittwoch, 18. März 2015, 13:19:07 schrieb Hannes Frederic Sowa: Hi Hannes, On Wed, Mar 18, 2015, at 13:14, Stephan Mueller wrote: Am Mittwoch, 18. März 2015, 13:02:12 schrieb Hannes Frederic Sowa: Hi Hannes, On Wed, Mar 18, 2015, at 12:09, Stephan Mueller wrote: Am Mittwoch, 18. März

Re: [BUG/PATCH] kernel RNG and its secrets

2015-03-18 Thread Daniel Borkmann
On 03/18/2015 01:20 PM, Stephan Mueller wrote: Am Mittwoch, 18. März 2015, 13:19:07 schrieb Hannes Frederic Sowa: Hi Hannes, On Wed, Mar 18, 2015, at 13:14, Stephan Mueller wrote: Am Mittwoch, 18. März 2015, 13:02:12 schrieb Hannes Frederic Sowa: Hi Hannes, On Wed, Mar 18, 2015, at 12:09,

Re: [BUG/PATCH] kernel RNG and its secrets

2015-03-18 Thread Hannes Frederic Sowa
On Wed, Mar 18, 2015, at 13:42, Daniel Borkmann wrote: On 03/18/2015 01:20 PM, Stephan Mueller wrote: Am Mittwoch, 18. März 2015, 13:19:07 schrieb Hannes Frederic Sowa: My proposal would be to add a #define OPTIMIZER_HIDE_MEM(ptr, len) __asm__ __volatile__ ( : : m( ({ struct { u8

Re: [BUG/PATCH] kernel RNG and its secrets

2015-03-18 Thread Stephan Mueller
Am Mittwoch, 18. März 2015, 16:09:34 schrieb Hannes Frederic Sowa: Hi Hannes, On Wed, Mar 18, 2015, at 13:42, Daniel Borkmann wrote: On 03/18/2015 01:20 PM, Stephan Mueller wrote: Am Mittwoch, 18. März 2015, 13:19:07 schrieb Hannes Frederic Sowa: My proposal would be to add a #define

Re: [BUG/PATCH] kernel RNG and its secrets

2015-03-18 Thread Theodore Ts'o
On Wed, Mar 18, 2015 at 06:56:19PM +0100, Hannes Frederic Sowa wrote: Maybe a BUILD_BUGON: ;) Even better! :-) - Ted __label__ l1, l2; char buffer[1024]; l1: memset(buffer, 0, 1024); l2: BUILD_BUGON(l1 == l2); -- To unsubscribe from this list:

Re: [BUG/PATCH] kernel RNG and its secrets

2015-03-18 Thread Theodore Ts'o
Maybe we should add a kernel self-test that automatically checks whether or not memset_explicit() gets optimized away? Otherwise we might not notice when gcc or how we implement barrier() or whatever else we end up using ends up changing. It shold be something that is really fast, so it might be

Re: [BUG/PATCH] kernel RNG and its secrets

2015-03-18 Thread mancha
On Wed, Mar 18, 2015 at 06:49:55PM +0100, Daniel Borkmann wrote: On 03/18/2015 06:14 PM, mancha wrote: ... Patch 0001 fixes the dead store issue in memzero_explicit(). Thanks! I have issued the fix for the memzero bug to Herbert in your authorship as discussed, also giving some more

Re: [BUG/PATCH] kernel RNG and its secrets

2015-03-18 Thread Cesar Eduardo Barros
On 18-03-2015 14:14, mancha wrote: On Wed, Mar 18, 2015 at 05:02:01PM +0100, Stephan Mueller wrote: Am Mittwoch, 18. März 2015, 16:09:34 schrieb Hannes Frederic Sowa: Seems like just using barrier() is the best and easiest option. However, if the idea is to use barrier() instead of

Re: [BUG/PATCH] kernel RNG and its secrets

2015-03-18 Thread mancha
On Wed, Mar 18, 2015 at 05:02:01PM +0100, Stephan Mueller wrote: Am Mittwoch, 18. März 2015, 16:09:34 schrieb Hannes Frederic Sowa: Hi Hannes, On Wed, Mar 18, 2015, at 13:42, Daniel Borkmann wrote: On 03/18/2015 01:20 PM, Stephan Mueller wrote: Am Mittwoch, 18. März 2015, 13:19:07

Re: [BUG/PATCH] kernel RNG and its secrets

2015-03-18 Thread Daniel Borkmann
On 03/18/2015 06:14 PM, mancha wrote: ... Patch 0001 fixes the dead store issue in memzero_explicit(). Thanks! I have issued the fix for the memzero bug to Herbert in your authorship as discussed, also giving some more context. For the 2nd issue, lets wait for Cesar. Thanks again! -- To

Re: [BUG/PATCH] kernel RNG and its secrets

2015-03-18 Thread Hannes Frederic Sowa
On Wed, Mar 18, 2015, at 18:41, Theodore Ts'o wrote: Maybe we should add a kernel self-test that automatically checks whether or not memset_explicit() gets optimized away? Otherwise we might not notice when gcc or how we implement barrier() or whatever else we end up using ends up changing.