smiiiiiiiiiiiiiiii
Exploiting System Management Mode with a very very very very very very very long interrupt.
Overview
It turns out that you can break SMM — the secure, ultra privileged execution environment running invisibly in the background of every x86 CPU — with nothing more than an obscenely long-running machine instruction.
SMM requires that all cores are either in SMM or out of SMM at the same time. Its security model doesn't work without this - when one thread enters SMM, it makes all the others enter too.
To break this, all we need is someone too busy to notice they're supposed to join SMM.
It works something like this:
core 0 - start a long instruction | | | core 1 - invite core 0 to smm | | | core 1 - enter smm | | | core 1 - wait for core 0 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | core 1 - wait for core 0 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | core 1 - wait for core 0 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | core 1 - wait for core 0 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | core 1 - wait for core 0 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | core 1 - wait for core 0 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | core 1 - wait for core 0 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | core 1 - wait for core 0 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | core 1 - give up core 1 - do secret smm stuff core 1 - finish smm | | | core 0 - join smm
At this point, core 1 is out of SMM while core 0 is in, letting core 1 attack core 0. Here's the catch: for this to work we need a very, very, verrrrry long instruction — longer than any instruction was ever supposed to take. Most machine instructions on a modern CPU are fast: add takes 1 cycle. To get core 1 to give up waiting on core 0, we need an instruction on core 0 that takes around 4,000,000,000 cycles — over 1 second of wall-clock time.
The One-Second Timeout
... continue reading