Fix CVE-2018-15594: x86/paravirt ensure Spectre-v2 mitigation patching works for paravirt guests #115
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
On paravirtual guests we could fail to rewrite certain indirect calls (e.g., CALLEE_SAVE paravirt functions like pv_queued_spin_unlock()), leaving indirect calls in place and weakening the Spectre-v2 mitigation that relies on avoiding indirect branches; this is tracked as CVE-2018-15594.
Changes
In arch/x86/kernel/paravirt.c, remove the incorrect clobber test in paravirt_patch_call() (the patch rewrites an indirect call into a direct call to the same function so clobbers cannot differ), and add WARN_ONCE diagnostics for the other patch failure case (insufficient room for the instruction) under CONFIG_RETPOLINE.
Security Impact
Restores intended Spectre-v2 hardening for paravirtual guests by ensuring indirect calls are properly patched, addressing CVE-2018-15594.
References
Upstream commit: 5800dc5c19f34e6e03b5adab1282535cb102fafd; CVE: CVE-2018-15594