Memory requests:
DRAM = dynamic random access memory:
Memory controller uses channels to talk to DRAM, each channel has a memory bus of 64 bits of data (set of pins to transfer info). Multiple channels for bus-level parallelism
DIMMs are memory modules, 1 or more per channel.
Ranks are collection of on-DIMM chips, each works independently but only can use data bus at any given time. Memory operations are rank-level in nature.
Chips are in a rank, all are active during a memory request, providing different data (so data bus is partitioned across chips). They can be 2x, 4x, 8x (for the number of bits they provide).
Each chip has multiple banks, commonly 16 (DDR4).
Each bank has multiple rows, for example 64k rows. Access one row at a time in bank to serve memory request.
Each row has a number of columns, e.g. 1k columns with 1 byte per column. See row as logically spanning across all chips on given rank.
Row buffer of given bank logically spans across all chips in a rank. To read/write a row, need to first load it into row buffer (‘activate’ it). After activating a row, the original data is gone, only preserved in the row buffer.
Physical address space != DRAM address space.
Memory controller decides mapping from physical to DRAM addresses, and the mapping has an impact on performance (and security).
Proprietary in DRAM subsystem:
Side channels need shared resource between different parties.
Timing side channel: “something” leaks depending on how fast the operation is
You can also probe the bus directly using an oscilloscope, and send requests for very different physical addresses.
Works because of DRAM defect on memory modules.
Under certain conditions, the capacitors quickly leak charge, causing bits to flip. All the attacker has to do from software is activate the same rows numerous times within a refresh interval.
If you repeatedly access row 0 and 2 in the same bank (aggressor rows), the capacitors in the middle row (row 1, victim row) leak charge and the data is corrupted.
Can be useful for e.g. privilege escalation, flipping bits in page tables.
Mitigations:
ECC memory:
Threat model: stolen laptop, DRAM holds secrets
DRAM cells keep charge for a while even if not refreshed, especially if cold.
Steps:
Mitigation: data scrambling – memory controller randomizes data encoding when writing data to DRAM.
MMU: multiple address spaces
Program the MMU using page tables. Modern architectures use four-level page tables (PML4).