google / safeside

Understand and mitigate software-observable side-channels
BSD 3-Clause "New" or "Revised" License
494 stars 54 forks source link

Replace shuffled vector with an LCG-based shuffled access pattern. #162

Open ssbr opened 3 years ago

ssbr commented 3 years ago

This should reduce/remove measurement artifacts from the shuffle vector. Since the shuffle vector is, itself, the same size as the buffer being tested for cache, it can lower the measured value by a factor of 2. In fact, it can reduce it by more than 2, because the buffer is of char and the shuffle vector is of int32 or even int64 -- meaning it could cut it by a whole order of magnitude!

Doing some concrete tests on my machine, with the new shuffle we can see a latency increase that really ramps up around 1MB (size of L2 on my laptop):

new boxplot

But with the old algorithm, it starts substantially earlier -- the median stabilizes to a new high value at aroung 100K, a size corresponding to nothing in particular as far as I'm aware:

old boxplot