google / safeside

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

Cross-address space recursive ret2spec. #65

Closed asteinha closed 4 years ago

asteinha commented 4 years ago

Tested also on unpatched ARM (Cavium).

asteinha commented 4 years ago

Is there any opportunity for us to share code between this and ret2spec_cyclic rather than having two programs that are ~60% similar?

Do you have a concrete idea how to do it? They are similar, but not the same. The only exception that can be move to a shared file is the LeakByte function. That one works the same way in both.

mmdriley commented 4 years ago

Considering one case, ReturnFalse: the only difference between the _sa and _ca versions is what they do when the recursion limit is hit. The first just returns, the second calls sched_yield. There are a lot of ways we could condense them:

A similar analysis applies to ReturnsTrue. And, as you noted, LeakByte is the same for both.

There's a broad design space here, and I don't have one concrete answer for the best way to approach this. But I feel like there's a good chance the solution looks like: both demos share a lot of common functions, slightly tweaked for their use case.

asteinha commented 4 years ago

Fixed. Ready for re-review.

asteinha commented 4 years ago

The Travis failure is unrelated to this PR.