arm64: Mitigate spectre style branch history side channels
Speculation attacks against some high-performance processors can make use of branch history to influence future speculation. When taking an exception from user-space, a sequence of branches or a firmware call overwrites or invalidates the branch history. The sequence of branches is added to the vectors, and should appear before the first indirect branch. For systems using KPTI the sequence is added to the kpti trampoline where it has a free register as the exit from the trampoline is via a 'ret'. For systems not using KPTI, the same register tricks are used to free up a register in the vectors. For the firmware call, arch-workaround-3 clobbers 4 registers, so there is no choice but to save them to the EL1 stack. This only happens for entry from EL0, so if we take an exception due to the stack access, it will not become re-entrant. For KVM, the existing branch-predictor-hardening vectors are used. When a spectre version of these vectors is in use, the firmware call is sufficient to mitigate against Spectre-BHB. For the non-spectre versions, the sequence of branches is added to the indirect vector. Reviewed-by:Catalin Marinas <catalin.marinas@arm.com> Signed-off-by:
James Morse <james.morse@arm.com>
Loading
-
mentioned in commit 4dc6240f
-
mentioned in commit 4dc6240f
-
mentioned in commit 604760bf
-
mentioned in commit c2765708
-
mentioned in commit 172da283
-
mentioned in commit 9b98cb78
-
mentioned in commit 30464878
-
mentioned in commit 816f62a5
-
mentioned in commit 5998eb3f
-
mentioned in commit 8b998d31
-
mentioned in commit 3c297d73
-
mentioned in commit 653f68cf
-
mentioned in commit 6b487ff8
-
mentioned in commit 1e50e672
-
mentioned in commit 777f973a
-
mentioned in commit 4a2f3d82
-
mentioned in commit 1c24e2af
-
mentioned in commit ed681e90
Please sign in to comment