Re: [PATCH] sha: prevent removal of memset as dead store in sha1_update()

2010-02-26 Thread Andi Kleen
> Instead of barrier(), this works with gcc-3.2.3 up to gcc-4.4.3 > for the purpose of making the memset() not disappear: > > { > struct s { char c[n]; }; > asm("" : : "m"(*(struct s *)p)); > } > > Every byte in the [p,p+n[ range must be used. If you only u

Re: [PATCH] sha: prevent removal of memset as dead store in sha1_update()

2010-02-26 Thread Mikael Pettersson
Mikael Pettersson writes: > Andi Kleen writes: > > roel kluin writes: > > > > >> And it's wrong because the reason the memset() is there seems to be > > >> to clear out key information that might exist kernel stack so that > > >> it's more difficult for rogue code to get at things. >

Re: [PATCH] sha: prevent removal of memset as dead store in sha1_update()

2010-02-26 Thread Mikael Pettersson
Andi Kleen writes: > roel kluin writes: > > >> And it's wrong because the reason the memset() is there seems to be > >> to clear out key information that might exist kernel stack so that > >> it's more difficult for rogue code to get at things. > > > > If the memset is optimized away then

Re: [PATCH] sha: prevent removal of memset as dead store in sha1_update()

2010-02-26 Thread Andi Kleen
roel kluin writes: >> And it's wrong because the reason the memset() is there seems to be >> to clear out key information that might exist kernel stack so that >> it's more difficult for rogue code to get at things. > > If the memset is optimized away then the clear out does not occur. Do you > k