A hardware bug forces expensive kernel protections
Summary
At the beginning of January 2018, rumours circulated about a hardware flaw in processors against which the kernel developers were hastily building costly protective measures. Felix von Leitner initially considered the loss of ASLR bearable, because ASLR only makes it harder to exploit vulnerabilities. An update corrected this: apparently normal programs could read kernel memory, and that is serious.
What was behind the rumour
A few days later Meltdown and Spectre were published. Meltdown exploited the fact that mainly Intel processors briefly process kernel memory contents during speculative execution before the permission check takes effect. These contents could then be read via cache measurements, such as keys or passwords. AMD processors were not affected by Meltdown, but they were by Spectre.
The defence was called kernel page table isolation: the kernel is removed from the address space every time execution switches back from user space. This costs time with every system call and mainly affects network services, databases and virtualisation.
The role of ASLR
ASLR places programs and the kernel randomly in memory so that attackers do not know where to jump. Von Leitner was right that ASLR does not prevent vulnerabilities but only makes exploitation harder, and that sandboxing with seccomp or W^X matter more. But the case also shows how quickly an assessment can change once the details become known.
Ideas
- ASLR makes exploiting vulnerabilities harder but does not prevent them.
- Speculative execution can reveal memory contents via cache measurements.
- Kernel page table isolation separates the kernel from programs’ address space at every switch.
Insights
- Hardware flaws can often only be worked around in software at a cost in performance.
- Early assessments of rumours have to be revised as soon as details are available.
Facts
- Meltdown and Spectre were published at the beginning of January 2018.
- AMD processors were not affected by Meltdown.
- The countermeasure in the Linux kernel is called kernel page table isolation.
References
Critique
- The post’s first assessment underestimated the vulnerability; the update corrects this openly.
Remarks
- Newer processors fix Meltdown in hardware, so the costly countermeasure is not needed there.
Recommendations
- Keep microcode and kernel up to date, because protection against processor flaws comes through both.
- After security updates, measure the performance of system-call-heavy services and plan for reserves.
Found a mistake or have something to add? Get in touch.
Links to the original source and the Web Archive open in a new tab.