MAD: Memory Allocation meets Software Diversity

The paper introduces MAD, a novel memory allocation diversity system that combines spatial diversification techniques with software diversity principles to effectively deter RowHammer attacks with negligible performance overhead and hardware agnosticism.

Manuel Wiesinger, Daniel Dorfmeister, Stefan Brunthaler

Published Thu, 12 Ma
📖 5 min read🧠 Deep dive

Here is an explanation of the paper "MAD: Memory Allocation meets Software Diversity" using simple language and creative analogies.

The Big Problem: The "RowHammer" Attack

Imagine your computer's memory (RAM) is a giant apartment building with millions of tiny rooms (memory cells). Each room holds a piece of data.

In 2014, hackers discovered a scary trick called RowHammer. It's like a burglar who doesn't need a key to break into a specific room. Instead, they stand in the hallway and jump up and down violently on the floorboards of the neighbors' rooms. If they jump fast enough and hard enough, the vibration shakes the lock on the target room open, changing the data inside without ever touching it.

This is a huge problem because it lets hackers steal secrets or take over your computer, even if they aren't supposed to have access.

The Old Solutions (And Why They Failed)

For a while, security experts tried to stop this by:

  1. Isolating the rooms: Putting guards between neighbors.
  2. Checking the locks: Using special hardware to fix errors.

But the hackers got smarter. They found ways to jump on many neighbors at once (not just one or two), and they found ways to trick the building's management system into putting the "victim" room right next to the "aggressor" rooms. The old defenses were like trying to stop a flood with a single sandbag; they worked for a little bit, but the water (the attack) eventually found a way around.

The New Solution: MAD (Memory Allocation Diversity)

The authors of this paper, Manuel, Daniel, and Stefan, came up with a new idea called MAD.

Instead of trying to build a stronger wall, they decided to make the apartment building chaotic and unpredictable. They realized that hackers succeed because the building's layout is predictable. If the hacker knows that "Room 101 is always next to Room 102," they can plan their jump.

MAD changes the rules so the layout is constantly shifting.

How MAD Works: The "Magic Recycling Bin"

Imagine the computer's memory manager is a librarian who hands out books (memory blocks) to people. Usually, the librarian is very organized: if you return a book, it goes back to the exact same shelf. This makes it easy for a hacker to predict where a book will be next time.

MAD introduces two new rules to the librarian:

1. The "Shuffle" (Horizontal Diversity)
When you return a book, the librarian doesn't put it back on the same shelf. Instead, they toss it into a "Shadow Bin" (a temporary holding area). When someone asks for a book, the librarian grabs one from the bin at random.

  • The Analogy: It's like a DJ spinning records. Even if you ask for the same song twice, the DJ might pull a different record from the crate, or play the same record but at a different time. The hacker can't predict which "record" (memory block) they will get next.

2. The "Merge and Split" (Vertical Diversity)
Sometimes the bins get empty. In a normal system, the librarian would just go get a fresh stack of books from the warehouse. But MAD is clever.

  • Merging: If two small empty boxes are next to each other in the bin, the librarian glues them together into a bigger box and hides it in a different part of the warehouse.
  • Splitting: If the librarian needs small boxes but only has big ones, they chop a big box in half and hide the pieces in random spots.
  • The Analogy: Imagine a game of Tetris where the blocks constantly change shape and move to random spots on the board. The hacker tries to build a specific shape to fit their attack, but the board keeps rearranging itself before they can finish.

Why This Stops the Attack

To pull off a RowHammer attack, the hacker needs to:

  1. Find the right "neighbor" rooms.
  2. Force the system to put the "victim" room right next to them.
  3. Do this over and over again until the vibration breaks the lock.

With MAD, the hacker is like a person trying to catch a specific bus in a city where the bus stops move every 5 seconds.

  • The Delay: The hacker might spend hours or days just trying to find the right configuration.
  • The Detection: Because MAD is constantly shuffling and recycling memory, if a hacker tries to grab all the memory to force a specific layout, the system notices the chaos. It's like a security guard noticing someone trying to buy every single ticket in a lottery just to guarantee a win. MAD can say, "Hey, that's suspicious!" and reboot the computer or alert the user before the attack succeeds.

The Bottom Line

MAD doesn't try to make the memory unbreakable; it makes the attack too hard and too slow to be worth it.

  • No New Hardware: It works with the computers we already have.
  • Fast: It doesn't slow down your computer.
  • Smart: It turns the memory management system into a chaotic, moving target that hackers can't predict.

In short, if RowHammer is a burglar trying to shake a door open, MAD is the house that keeps moving the door to a different wall every time the burglar tries to jump. Eventually, the burglar gives up.