[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150410142208.GA16910@zoho.com>
Date: Fri, 10 Apr 2015 14:22:08 +0000
From: mancha security <mancha1@...o.com>
To: Stephan Mueller <smueller@...onox.de>
Cc: Hannes Frederic Sowa <hannes@...essinduktion.org>,
Daniel Borkmann <daniel@...earbox.net>, tytso@....edu,
linux-kernel@...r.kernel.org, linux-crypto@...r.kernel.org,
herbert@...dor.apana.org.au, dborkman@...hat.com
Subject: Re: [BUG/PATCH] kernel RNG and its secrets
On Fri, Apr 10, 2015 at 04:09:10PM +0200, Stephan Mueller wrote:
> Am Freitag, 10. April 2015, 16:00:03 schrieb Hannes Frederic Sowa:
>
> Hi Hannes,
>
> >On Fr, 2015-04-10 at 15:25 +0200, Stephan Mueller wrote:
> >> I would like to bring up that topic again as I did some more analyses:
> >>
> >> For testing I used the following code:
> >>
> >> static inline void memset_secure(void *s, int c, size_t n)
> >> {
> >>
> >> memset(s, c, n);
> >>
> >> BARRIER
> >>
> >> }
> >>
> >> where BARRIER is defined as:
> >>
> >> (1) __asm__ __volatile__("" : "=r" (s) : "0" (s));
> >>
> >> (2) __asm__ __volatile__("": : :"memory");
> >>
> >> (3) __asm__ __volatile__("" : "=r" (s) : "0" (s) : "memory");
> >
> >Hm, I wonder a little bit...
> >
> >Could you quickly test if you replace (s) with (n) just for the fun of
> >it? I don't know if we should ask clang people about that, at least it
> >is their goal to be as highly compatible with gcc inline asm.
>
> Using
>
> __asm__ __volatile__("" : "=r" (n) : "0" (n) : "memory");
>
> clang O2/3: no mov
>
> gcc O2/3: mov present
>
> ==> not good
>
>
> Using
> __asm__ __volatile__("" : "=r" (n) : "0" (n));
>
> clang O2/3: no mov
>
> gcc O2/3: no mov
>
>
> ==> not good
>
>
> What do you expect that change shall do?
>
> >
> >Thanks for looking into this!
> >
> >Bye,
> >Hannes
>
>
> Ciao
> Stephan
Thanks for the comprehensive testing! Clang 3.3 and was giving me good
results; didn't try newer versions.
I wonder what your tests give with an earlier suggestion of mine:
#define barrier(p) __asm__ __volatile__("": :"r"(p) :"memory")
void memzero_explicit(void *s, size_t count)
{
memset(s, 0, count);
barrier(s);
}
--mancha
Content of type "application/pgp-signature" skipped
Powered by blists - more mailing lists