News for hackers. Stuff that matters.
Re:Memory Deduplication: The Curse that Keeps on Giving [video] by cixin on Sunday January 08, 2017 @07:38AM (#13349469)
The final conclusion the speaker comes to in this talk is that you should disable de-duplication. It doesn't seem like there are any ways of mitigating it suggested.

Essentially, the first method is a timing attack. If can tell if a crafted page is duplicated or not by the time it takes to modify the page.

Modifying a defuplicated page will take longer, because a new copy has to be created. The only way I can see around this is to introduce random delays into all page writes, this might be feasible I guess, if you only needed to delay a small percentage of writes. However it's likely the performance penalty would be unacceptable.

Re:Memory Deduplication: The Curse that Keeps on Giving [video] by ris on Sunday January 08, 2017 @08:30AM (#13349615)
I guess something that could help would be for the deduplicator to be slightly more conservative. When doing a deduplication pass, if it finds a duplicate page, rather than merging them straight off, mark one of the pages as "reclaimable", but only do that reclaim once the page is required for recycling. In the intervening time, the different users are still pointing at their private copies and no CoW has to take place if there is a modification (it is simply un-marked as a deduplication candidate). "Lazy" deduplication.

Then the attacker would also have to force the system into enough memory pressure to be requesting to recycle these pages - something it may not be in the position to do if it is a guest with capped resources. The pages would also presumably be recycled in a less predictable order, making it harder to come up with simple a "wait 10 minutes" rule to ensure the recycling has taken place.

Now, I'm sure what I've described would not be particularly simple to implement, but that's another thing.

Re:Memory Deduplication: The Curse that Keeps on Giving [video] by DannyBee on Sunday January 08, 2017 @09:06AM (#13349701)
This also has performance implications since now you can't use the "reclaimable" memory for cache, etc.
Re:Memory Deduplication: The Curse that Keeps on Giving [video] by ris on Sunday January 08, 2017 @09:22AM (#13349769)
Well, I'd say if the need arises to use it for cache, reclaim it and perform the dedup.
Re:Memory Deduplication: The Curse that Keeps on Giving [video] by DannyBee on Sunday January 08, 2017 @09:09AM (#13349713)
"Modifying a defuplicated page will take longer, because a new copy has to be created."

Well, kinda. They only eventually have to be created.

You don't have to create the new copy immediately, you could overlay new data on the old page

(IE create new sparse page. Anything filled in on the new page is read from new page, anything else goes to backing dedupe'd page. real copy is made in background so this goes back to being fast)

Of course, this mostly just makes it harder, assuming you can place enough memory pressure on the machine.

Re:Memory Deduplication: The Curse that Keeps on Giving [video] by Filligree on Sunday January 08, 2017 @01:00PM (#13350982)
And how would you implement a "sparse page"?

Without hardware support, the only idea I can think of is to mark the page unreadable and pass all memory reads through the kernel. Which would be readily detectable... among other problems.

Re:Memory Deduplication: The Curse that Keeps on Giving [video] by DannyBee on Sunday January 08, 2017 @01:54PM (#13351261)
Sure, you'd need hardware support. But, for example, hardware dedup is infeasible (IE you can make the compression go in hardware, but the management, not so much or sanely. Unless you can make both constant time, ...).

Sparse pages are at least feasible in hardware.

Also, you realize that passing all memory reads through the kernel is what any read barrier garbage collected language does, right?