arm-trusted-firmware/include
Joel Hutton 9edd891279 Initial Spectre V1 mitigations (CVE-2017-5753).
Initial Spectre Variant 1 mitigations (CVE-2017-5753).
A potential speculative data leak was found in PSCI code, this depends
on a non-robust implementation of the `plat_get_core_pos_by_mpidr()`
function. This is considered very low-risk. This patch adds a macro to
mitigate this. Note not all code paths could be analyzed with current
tools.

Add a macro which makes a variable 'speculation safe', using the
 __builtin_speculation_safe_value function of GCC and llvm. This will be
available in GCC 9, and is planned for llvm, but is not currently in
mainline GCC or llvm. In order to implement this mitigation the compiler
must support this builtin. Support is indicated by the
__HAVE_SPECULATION_SAFE_VALUE flag.

The -mtrack-speculation option maintains a 'tracker' register, which
determines if the processor is in false speculation at any point. This
adds instructions and increases code size, but avoids the performance
impact of a hard barrier.

Without the -mtrack-speculation option, __builtin_speculation_safe_value
expands to a

    ISB
    DSB SY

sequence after a conditional branch, before the
speculation safe variable is used. With -mtrack-speculation a

    CSEL tracker, tracker, XZR, [cond];
    AND safeval,tracker;
    CSDB

sequence is added instead, clearing the vulnerable variable by
AND'ing it with the tracker register, which is zero during speculative
execution. [cond] are the status flags which will only be true during
speculative execution. For more information on
__builtin_speculation_safe_value and the -mtrack-speculation option see
https://developer.arm.com/support/arm-security-updates/speculative-processor-vulnerability/compiler-support-for-mitigations

The -mtracking option was not added, as the performance impact of the
mitigation is low, and there is only one occurence.

Change-Id: Ic9e66d1f4a5155e42e3e4055594974c230bfba3c
Signed-off-by: Joel Hutton <Joel.Hutton@Arm.com>
2018-11-26 13:22:14 +00:00
..
bl1 Standardise header guards across codebase 2018-11-08 10:20:19 +00:00
bl2 Standardise header guards across codebase 2018-11-08 10:20:19 +00:00
bl2u Standardise header guards across codebase 2018-11-08 10:20:19 +00:00
bl31 Standardise header guards across codebase 2018-11-08 10:20:19 +00:00
bl32 Standardise header guards across codebase 2018-11-08 10:20:19 +00:00
common Standardise header guards across codebase 2018-11-08 10:20:19 +00:00
drivers drivers/tzc-dmc620: add driver to setup DMC-620 TZC controller 2018-11-21 19:25:35 +05:30
dt-bindings stm32mp1: Add device tree files 2018-07-24 17:18:35 +02:00
lib Initial Spectre V1 mitigations (CVE-2017-5753). 2018-11-26 13:22:14 +00:00
plat plat/marvell: Migrate to multi-console API 2018-11-15 13:42:45 +02:00
services Standardise header guards across codebase 2018-11-08 10:20:19 +00:00
tools_share Standardise header guards across codebase 2018-11-08 10:20:19 +00:00