Microsoft introduces drastic performance fix for Spectre variant
Return + trampoline = retpolineBy Greg Synek 7 comments
Something to look forward to: Spectre has caused its share of problems, but performance fixes are on the way to Windows 10 users. A clever control flow technique developed by Google and then adapted to the Windows kernel by Microsoft is intended to drastically speed up processes that rely on speculative execution without compromising security.
After fixes were introduced for several variants of the Spectre speculative execution exploit, performance took a nose dive. Microsoft and many other industry giants have been working to patch security flaws for over a year now, but most fixes have degraded performance. Borrowing ideas from Google, Microsoft has now pushed out "retpoline for Windows" to improve CPU performance.
Retpoline is a portmanteau of return and trampoline. Instead of guessing where a program will jump to next during its execution, an indirect method of determining where to go is implemented. When an attacker attempts to scrape information available from speculative executions, the results yield no valuable data because there are too many locations where the desired information could have ended up. For the full technical explanation of this process, Google has details on how preventing branch-target injection works.
Imagine speculative execution as an overly energetic 7-year old that we must now build a warehouse of trampolines around. -Paul Turner, Google Senior Staff Engineer
At runtime, any indirect jumps in software are identified and fixed in memory following a kernel examination. Not all programs can make use of retpoline sequences in every instance, but it is enough to make Spectre effectively useless for malicious users.
The end result of Microsoft's latest performance update shows up to 25 percent improvements in application launch times. Storage throughput has increase 1.5- times in DiskSpd benchmarks, while networking has also seen drastic improvements on Broadwell CPUs.
Currently, retpoline optimizations are only available as part of the Windows Insider Preview builds version 18272 and above, but will be shipping as a standard feature during the first half of this year. It can be enabled or disabled through registry tweaks and checked via a PowerShell command.