Kim starts the program, and it does almost nothing. The loop reads address X, then address Y. It flushes both from the processor's cache with an instruction called clflush, issues a fence, mfence, that makes the processor finish each step before it begins the next, and jumps back to the top. Then it does it all again. After around 139,000 accesses, a bit flips in the memory module.
The flipped bit sits in a row of memory the program never addressed. The loop only read, and reading is supposed to leave memory as it found it. So how can reading corrupt memory the program never touched?
The program is deliberately plain. It runs at user level, with no special privileges, and it issues loads to the same address while flushing the cache line in between. The flush matters because it forces every load to go back to the DRAM chip instead of being answered from the cache. Read from one address often enough, Kim and his co-authors showed, and data at nearby addresses gets corrupted.
The first consequence is how common the weak spots may be. Tests show that up to one cell in every 1,700 may be susceptible. It is a property that any ordinary program could set off, and nobody had yet worked out why.
110 of 129 modules flipped
Kim had one flip, and a single flip proves little. It could belong to one cranky module on one bench. So he and his co-authors carried the loop to other machines and other memory, and presented what they found in June 2014 at the International Symposium on Computer Architecture.
The talk carried a title that sounded like a riddle, "Flipping Bits in Memory Without Accessing Them." Its list of authors ran long: Ross Daly, Jeremie Kim, Chris Fallin, Ji Hye Lee, Donghyuk Lee, Chris Wilkerson, Konrad Lai and Onur Mutlu, alongside Kim himself.
Their test bed was 129 real DDR3 modules, which together held 972 DRAM chips. The chips came from three manufacturers, which the paper keeps anonymous and labels A, B and C. Everyone assumed that memory like this was safe, and the team set out to see whether that held for the chips people actually buy.
The tally came back lopsided in the wrong direction. Among maker A's modules, 86 percent were vulnerable, 37 of 43. Maker B did hardly better, at 83 percent.

Maker C fell in line at 88 percent, and the grand total was 110 modules that flipped. The authors induced errors in 110 of the 129 and concluded that many deployed systems were likely at risk.
In a more controlled environment, the lab could do far worse than a stray flip here and there. Kim's team could induce as many as ten million disturbance errors. But the cells in those neighboring rows had never been addressed. Why did they flip?
Why a read is not harmless
Kim went looking for the cause, and the first thing in his way was a habit of thought. A read looks harmless. Yet reading in DRAM, the memory in a computer's main banks, has never been free: a cell's value is copied into a row buffer, which wipes the cell, so the chip must write the value back afterward.
Kim and his co-authors pinned the root cause on the wiring. Every access to a row switches its wordline, the line that selects the row, and a program that hammers the same row makes that line toggle again and again. Each toggle sends a voltage fluctuation through the chip. Repeated often enough, it stresses the coupling between neighboring cells and pulls charge out of the nearby rows, called victim rows, faster than nature would.
Kim first tried the obvious suspects. He set the victim cells beside the weak, leaky ones that engineers already knew how to screen for, and waited for the two lists to line up. They almost never did. Heat was next. He pushed the chips colder and hotter than the 50°C default and counted the errors each time, expecting the numbers to jump. They shifted by less than 15%, and he crossed heat off the list too.
The flips were also not random. Across ten rounds of testing, more than 70% of the victim cells showed errors in every single round. The same cells failed the same way each time, which meant an attacker could aim at them.
That aim carried the worst consequence. An operating system hands memory to programs in 4KB pages, and a DRAM row holds 8KB, so a page fits inside one row. The row next door therefore belongs to a different page, perhaps to a different program or to the system itself. A loop that only touches its own memory can still reach across that border, and memory protection, the rule that keeps programs out of each other's data, is breached.
The patent that appeared mid-review
While the paper sat in review, Kim and his co-authors started digging into the history. They wanted to know how long this flaw had been loose in the world, and the obstacle was silence: nobody in the industry had said a word about it in public. The trail ran through patent filings instead. By at least 2012, Intel had filed patent applications that used the phrase "row hammer".
The authors learned the rest of it in an awkward way. Their paper was still under review when the earliest of those Intel patents was released to the public. A problem Kim had caught with a small test program already had a name inside the company that built the processors, and a legal document to go with it.
The authors laid the history out on a timeline. It begins in 2010 with the first DRAM in which one row could couple electrically to the next, and disturbance errors had been slipping into the field ever since. Their own observation sits at 2013 on the same line.
Patents that mention "Row Hammer" by name arrive on that line in 2014.

The talk reaches back further for a voice. Joel Karp, who designed the Intel 1103, once described the wiring in terms an engineer could picture: a "big fat metal line with full level signals running right over the storage node".
A fix that costs almost nothing
Kim and his co-authors started with the cures that anyone would reach for first. The bluntest was to throttle memory, capping how often a program could open the same row at no more than 128K accesses per 64 milliseconds. A chip that refuses to answer fast enough cannot be hammered, but it cannot serve honest programs quickly either.
The second cure was to refresh every row about 7 times more often, so that a victim cell would be topped up before the neighbours could drain it. Every extra refresh keeps the memory busy and draws more power. The team ran the numbers on both ideas and found real costs in performance and in energy.
So they designed something lighter and gave it a name: PARA, for probabilistic adjacent row activation. Whenever a row is closed, the controller flips a heavily weighted coin. With a probability of only 0.005, it activates one neighbour of that row, which refreshes the cells that the toggling has been wearing down.
A row that is hammered has to be closed again and again, and each closing is another toss of the coin. Sooner or later a neighbour gets its refresh before the damage adds up. With that setting, the talk puts the chance of an error in a full year at 9.4×10^-14.
The price barely registered. Across 29 benchmarks, PARA slowed programs by 0.20% on average.

The worst case reached only 0.75%. The controller also keeps no counters and no table of which rows have been touched, so PARA is stateless and adds no bookkeeping to the chip. But the paper left one thing open for future research: an attack that used the flaw. Someone was already reading it.
Project Zero takes the paper at its word
Mark Seaborn and Thomas Dullien, two security engineers on Google's Project Zero team, read Kim's paper and stopped at one sentence. The authors wrote that, with some engineering effort, the flaw might become an attack that injects errors, crashes a system, or perhaps hijacks control, and that they would leave this research for the future. Seaborn and Dullien took the sentence as an assignment.
A flipped bit is damage, but it is not command of a machine. Kim's loop had shown that memory could be corrupted; nobody had shown that anyone could aim the corruption.
On March 9, 2015, Project Zero revealed that the two engineers had done it. They had built two working privilege escalation exploits on x86-64, both based on Rowhammer.
The first went after Google Native Client, known as NaCl, a sandbox built to confine untrusted code. The exploit broke out of that cage and issued system calls directly, and the hole was tracked as CVE-2015-0565.
The second ran as an ordinary, unprivileged Linux process. It sprayed memory with page tables, the maps that translate a program's virtual addresses into physical ones, so that a disturbance error had a good chance of landing on one of them. Once a flip altered an entry, the process could reach all physical memory without restriction.
Google closed the NaCl hole by disallowing the clflush instruction, the command that evicts data from the cache. Everyone had believed an effective Rowhammer attack required it, and Kim's own loop flushed on every pass. Whether the belief would survive a determined attacker was a question nobody had yet put to the test.
Vendors say solved, then a web page says otherwise
Some of the defences were already in place before Project Zero went public. Intel's memory controllers had carried a safeguard called pseudo target row refresh, or pTRR, as early as 2014, added to protect vulnerable DDR3 modules.
After Seaborn and Dullien's exploits, the memory industry added more. The standards body JEDEC wrote optional hardware support for target row refresh, or TRR, into its LPDDR4 standard, the one for low-power memory. Some manufacturers went further and built TRR into their DDR4 products, even though the DDR4 standard never asked for it.
Vendors scrambled to deliver TRR as the definitive hardware solution. Among the engineers who bought and deployed the memory, a comfortable belief took hold: RowHammer was no longer an issue on TRR-protected DDR4.
Then Gruss, Maurice and Mangard published a paper that went after the one assumption everyone had kept. Kim's loop flushed the cache on every pass, and Google had closed its sandbox hole by banning the flush instruction. The three researchers showed that Rowhammer could be triggered with only regular memory accesses, no cache flush needed.
They did not stop at a laboratory trick. Their attack was fully automated and needed nothing but a website running JavaScript to trigger faults on remote hardware. A visitor only had to load the page.
The authors also stated plainly that the existing countermeasures fail to protect against this new Rowhammer attack.
Nineteen rows, forty modules, one loop
Researchers testing the TRR-protected DDR4 modules did not take the vendors' word for it. They hammered the chips with access patterns the defences had never been designed to expect. A method called Many-sided RowHammer showed that the flaw survived TRR in some cases with as many as 19 aggressor rows, enough to confuse a chip that tracked only a few suspects at a time. Of the 42 modules from Samsung, Micron and Hynix, 13 fell to these TRR-aware patterns.
With the mitigation switched off, flips began after as few as 45K row activations, against the roughly 139K Kim's loop had needed on DDR3. DDR4 and LPDDR4(X) turned out to be more fragile than the generation they replaced. Blacksmith then pushed further by hammering aggressor rows with different phases, frequencies and amplitudes, so the pattern never settled into anything a defence could learn. Bits flipped on all 40 recently purchased DDR4 DIMMs, and on average 87 times more of them than before. The authors drew a bleak conclusion: after almost a decade, they may be in a worse situation than when Rowhammer was first discovered. Kim's own talk had ended on a warning that, with the difficulties of DRAM scaling, new and unexpected types of failures may appear.
Every one of these attacks still comes down to the loop Kim wrote: read, flush, fence, jump back. Each patch has met a cleverer pattern, and nobody has closed the hole Kim opened. Somewhere a program is still reading two addresses over and over, and a row it never touched is giving way.
Cover: ArnoldReinhold · CC BY-SA 4.0 · Wikimedia Commons. Layout and headline text by Signal Titans.
Source: Flipping Bits Without Touching Them: Yoongu Kim, Rowhammer and the Memory Flaw Hidden in Plain Sight · arxiv.org · arxiv.org · US20140059287A1 – Row hammer refresh command – Google Patents · users.ece.cmu.edu · www.eng.utah.edu · www.cs.toronto.edu · users.ece.cmu.edu · comsec.ethz.ch

Leave a Reply