209 points · by ColinWright · 11y ago · 81 comments
There was a great TR from IBM describing memory system design for one of their PowerPC chips. Summary: Do your board layout, follow all these rules [a big list], then plan to spend six months in a lab twiddling transmission line parameters and re-doing layout until you're sure it works . . .
Analog is a black art.
Link: http://www.amazon.com/High-Speed-Digital-Design-Handbook/dp/...
Long story short was that spansion changed from gold to copper feeder wires inside their memory chip and was in every so many chips causing bit flip problems.
Our end product is in the automotive space averaging 300,000 units per year. It's a non safety related component.
Hiding complexity behind abstractions is what allows us to build complex things.
For a small example, Look at the simplest SR latch circuit... It's metastable because it feedsback into itself.
https://github.com/CMU-SAFARI/rowhammer
in Ubuntu 14.04, run this to bring all the dependencies for building: sudo apt-get build-dep memtest86+
Update: just finished running the test on my cheap Lenovo laptop. Not affected. phew! :)
Announcement http://www.passmark.com/forum/showthread.php?4836-MemTest86-...
Previous discussion https://news.ycombinator.com/item?id=8713411
It's interesting to see this issue addressed in 2015. In 1980 I worked at Alpha Microsystems and designed a memory chip test program which used translation tables based upon information we required chip manufacturers to give us in order for their chips to be used in the systems we sold.
That approach required us to only put one type of memory chip on a memory board. But back in the day microsytems were expensive and customers expected them to be well-tested.
Back in mid-1979, just before I went to college, I looked at the current alternatives and picked Alpha Micro as the company to go with for a system to computerize a bunch of doctor's offices. It worked very well, and then another one a few years later when they used one to help systematize a company providing satellite TV gear.
1. Note that chip-kill/Extended ECC/Advanced ECC/Chipspare which are all similar server vendor methods for 4-bit correction will prevent this problem. These methods are enabled on the better reliability server systems.
2. This failure mode has been known by the DRAM industry for a couple years now and the newest DRAM parts being produced have this problem solved. The exact solution varies by DRAM vendor. I wish I could go into specifics but I am unaware of any vendor that has stated publicly their fix.
How new exactly? The newest tested in the paper is from July 2014 and that still has the problem.
It doesn't fix systems deployed right now, and could be used for attacking hypervisors and other multitenant systems. Might make an interesting class of local privilege escalation attacks to try probabilistically of otherwise correctly-secured systems too.
I know there are other parameters of the memory controller that could be changed to cause corruption, e.g. reducing the refresh rate or tweaking the timings, but that is likely to yield random corruptions in normal use instead of this precise one.
To me, the real solution seems to be stop making DRAM with such high density processes until some design changes can be done that make them as reliable as before, because at some point it just stops behaving like real memory anymore and turns into a crude approximation of it; memory should be reliable and store the data it holds, without any corruption regardless of access pattern.
A good first check for security companies - examine all known attacks for fence instructions, which are rare. (Without a fence instruction, hammering on the same addresses will just cycle the caches, and not go out to DRAM.) Look at the code near them for a hammering loop.
This is a promising attack, because it might be able to break through a virtual machine boundary.
A test for this should be shipped with major Linux distros, and run during install. When someone like Amazon, Rackspace, or Google sends back a few thousand machines as rejects, this will get fixed.
(Fences guarantee only memory ordering, and are typically implemented by flushing to cache, not to RAM.)
Note that for the test to do row hammering effectively, it must pick two addresses that are in different rows but in the same bank. A good way of doing that is just to pick random pairs of addresses. If your machine has 16 banks of DRAM, for example (as various machines I've tested do), there should be a 1/16 chance that the two addresses are in the same bank. This is what the test above does. (Actually, it picks >2 addresses to hammer per iteration.)
Be careful about running the test, because on machines that are susceptible to rowhammer, it could cause bit flips that crash the machine (or worse, bit flips in data that gets written back to disc).
High speed DRAM reads influence nearby cells. Reproduced on 110 of 139 mem modules after 139k reads on intel and amd. 1 in 1.7k cells affected.
Second: While the problem looks real enough, the tests to demonstrate it are not realistic. Hammering the same rows with consecutive reads does not happen in the real world due to caches which the get around via flushes. I'd like to see more data on how bad the abuse needs to be to cause the problem. Will 2 reads in a row cause errors? 5? 10? 100? They never address how likely this is to be a real-world problem. I don't doubt that it is, but how often?
Secondly, the DRAM makers don't currently provide enough information to reliably know what neighbors to refresh. I suppose they could have used their guesses to test on the FPGA rig but given the rest of the paper I'm reasonably satisfied that they have correctly identified the problem and that their solution would work.
I can see "exploit resistant memory" being a selling point, maybe soon.
Want to wrap yourself around another challenging aspect of high-speed design? Power distribution system design (PDS). You can design perfect boards based on solid transmission line and RF theory and have them fail to work due to issues such as frequency-dependent impedances and resonance in the PDS.
You're essentially saying that producing DRAM that doesn't work like memory should, regardless of access pattern, is excusable because it's "commodity"?
Why not?
If the attack can only be reproduced by custom hardware, why should anyone care?
Also, precise patterns of access to DRAM would require disabling the L1 and L2 caches. Doesn't that sort of thing require privileged instructions?
With caching in place, memory accesses are indirect. You have to be able to reproduce the attack using only patterns of cache line loads and spills.
They evict cache lines using the CLFLUSH x86 instruction, which I believe is unprivileged.
There's not that many DRAM manufacturers in the world. Micron, Samsung, Elpida, Hynix are all excellent bets.
Edit: Just checking, it was at 120, looks like it got artificially promoted to 25, then sank quickly.
How does that happen?
I think it's a good thing, even if it's somewhat arbitrary and has multiple false-positives and false-negatives. I've always been a fan of stochastic processes - they exhibit lots of good behavior, and comparatively few pathological flaws.