16e885594STim Chen.. SPDX-License-Identifier: GPL-2.0
26e885594STim Chen
36e885594STim ChenSpectre Side Channels
46e885594STim Chen=====================
56e885594STim Chen
66e885594STim ChenSpectre is a class of side channel attacks that exploit branch prediction
76e885594STim Chenand speculative execution on modern CPUs to read memory, possibly
86e885594STim Chenbypassing access controls. Speculative execution side channel exploits
96e885594STim Chendo not modify memory but attempt to infer privileged data in the memory.
106e885594STim Chen
116e885594STim ChenThis document covers Spectre variant 1 and Spectre variant 2.
126e885594STim Chen
136e885594STim ChenAffected processors
146e885594STim Chen-------------------
156e885594STim Chen
166e885594STim ChenSpeculative execution side channel methods affect a wide range of modern
176e885594STim Chenhigh performance processors, since most modern high speed processors
186e885594STim Chenuse branch prediction and speculative execution.
196e885594STim Chen
206e885594STim ChenThe following CPUs are vulnerable:
216e885594STim Chen
226e885594STim Chen    - Intel Core, Atom, Pentium, and Xeon processors
236e885594STim Chen
246e885594STim Chen    - AMD Phenom, EPYC, and Zen processors
256e885594STim Chen
266e885594STim Chen    - IBM POWER and zSeries processors
276e885594STim Chen
286e885594STim Chen    - Higher end ARM processors
296e885594STim Chen
306e885594STim Chen    - Apple CPUs
316e885594STim Chen
326e885594STim Chen    - Higher end MIPS CPUs
336e885594STim Chen
346e885594STim Chen    - Likely most other high performance CPUs. Contact your CPU vendor for details.
356e885594STim Chen
366e885594STim ChenWhether a processor is affected or not can be read out from the Spectre
376e885594STim Chenvulnerability files in sysfs. See :ref:`spectre_sys_info`.
386e885594STim Chen
396e885594STim ChenRelated CVEs
406e885594STim Chen------------
416e885594STim Chen
426e885594STim ChenThe following CVE entries describe Spectre variants:
436e885594STim Chen
444c920576SJosh Poimboeuf   =============   =======================  ==========================
456e885594STim Chen   CVE-2017-5753   Bounds check bypass      Spectre variant 1
466e885594STim Chen   CVE-2017-5715   Branch target injection  Spectre variant 2
474c920576SJosh Poimboeuf   CVE-2019-1125   Spectre v1 swapgs        Spectre variant 1 (swapgs)
484c920576SJosh Poimboeuf   =============   =======================  ==========================
496e885594STim Chen
506e885594STim ChenProblem
516e885594STim Chen-------
526e885594STim Chen
536e885594STim ChenCPUs use speculative operations to improve performance. That may leave
546e885594STim Chentraces of memory accesses or computations in the processor's caches,
556e885594STim Chenbuffers, and branch predictors. Malicious software may be able to
566e885594STim Cheninfluence the speculative execution paths, and then use the side effects
576e885594STim Chenof the speculative execution in the CPUs' caches and buffers to infer
586e885594STim Chenprivileged data touched during the speculative execution.
596e885594STim Chen
606e885594STim ChenSpectre variant 1 attacks take advantage of speculative execution of
616e885594STim Chenconditional branches, while Spectre variant 2 attacks use speculative
626e885594STim Chenexecution of indirect branches to leak privileged memory.
63e9b6013aSKim PhillipsSee :ref:`[1] <spec_ref1>` :ref:`[5] <spec_ref5>` :ref:`[6] <spec_ref6>`
64e9b6013aSKim Phillips:ref:`[7] <spec_ref7>` :ref:`[10] <spec_ref10>` :ref:`[11] <spec_ref11>`.
656e885594STim Chen
666e885594STim ChenSpectre variant 1 (Bounds Check Bypass)
676e885594STim Chen---------------------------------------
686e885594STim Chen
696e885594STim ChenThe bounds check bypass attack :ref:`[2] <spec_ref2>` takes advantage
706e885594STim Chenof speculative execution that bypasses conditional branch instructions
716e885594STim Chenused for memory access bounds check (e.g. checking if the index of an
726e885594STim Chenarray results in memory access within a valid range). This results in
736e885594STim Chenmemory accesses to invalid memory (with out-of-bound index) that are
746e885594STim Chendone speculatively before validation checks resolve. Such speculative
756e885594STim Chenmemory accesses can leave side effects, creating side channels which
766e885594STim Chenleak information to the attacker.
776e885594STim Chen
786e885594STim ChenThere are some extensions of Spectre variant 1 attacks for reading data
796e885594STim Chenover the network, see :ref:`[12] <spec_ref12>`. However such attacks
806e885594STim Chenare difficult, low bandwidth, fragile, and are considered low risk.
816e885594STim Chen
824c920576SJosh PoimboeufNote that, despite "Bounds Check Bypass" name, Spectre variant 1 is not
834c920576SJosh Poimboeufonly about user-controlled array bounds checks.  It can affect any
844c920576SJosh Poimboeufconditional checks.  The kernel entry code interrupt, exception, and NMI
854c920576SJosh Poimboeufhandlers all have conditional swapgs checks.  Those may be problematic
864c920576SJosh Poimboeufin the context of Spectre v1, as kernel code can speculatively run with
874c920576SJosh Poimboeufa user GS.
884c920576SJosh Poimboeuf
896e885594STim ChenSpectre variant 2 (Branch Target Injection)
906e885594STim Chen-------------------------------------------
916e885594STim Chen
926e885594STim ChenThe branch target injection attack takes advantage of speculative
936e885594STim Chenexecution of indirect branches :ref:`[3] <spec_ref3>`.  The indirect
946e885594STim Chenbranch predictors inside the processor used to guess the target of
956e885594STim Chenindirect branches can be influenced by an attacker, causing gadget code
966e885594STim Chento be speculatively executed, thus exposing sensitive data touched by
976e885594STim Chenthe victim. The side effects left in the CPU's caches during speculative
986e885594STim Chenexecution can be measured to infer data values.
996e885594STim Chen
1006e885594STim Chen.. _poison_btb:
1016e885594STim Chen
1026e885594STim ChenIn Spectre variant 2 attacks, the attacker can steer speculative indirect
1036e885594STim Chenbranches in the victim to gadget code by poisoning the branch target
1046e885594STim Chenbuffer of a CPU used for predicting indirect branch addresses. Such
1056e885594STim Chenpoisoning could be done by indirect branching into existing code,
1066e885594STim Chenwith the address offset of the indirect branch under the attacker's
1076e885594STim Chencontrol. Since the branch prediction on impacted hardware does not
1086e885594STim Chenfully disambiguate branch address and uses the offset for prediction,
1096e885594STim Chenthis could cause privileged code's indirect branch to jump to a gadget
1106e885594STim Chencode with the same offset.
1116e885594STim Chen
1126e885594STim ChenThe most useful gadgets take an attacker-controlled input parameter (such
1136e885594STim Chenas a register value) so that the memory read can be controlled. Gadgets
1146e885594STim Chenwithout input parameters might be possible, but the attacker would have
1156e885594STim Chenvery little control over what memory can be read, reducing the risk of
1166e885594STim Chenthe attack revealing useful data.
1176e885594STim Chen
1186e885594STim ChenOne other variant 2 attack vector is for the attacker to poison the
1196e885594STim Chenreturn stack buffer (RSB) :ref:`[13] <spec_ref13>` to cause speculative
1206e885594STim Chensubroutine return instruction execution to go to a gadget.  An attacker's
1216e885594STim Chenimbalanced subroutine call instructions might "poison" entries in the
1226e885594STim Chenreturn stack buffer which are later consumed by a victim's subroutine
1236e885594STim Chenreturn instructions.  This attack can be mitigated by flushing the return
1246e885594STim Chenstack buffer on context switch, or virtual machine (VM) exit.
1256e885594STim Chen
1266e885594STim ChenOn systems with simultaneous multi-threading (SMT), attacks are possible
1276e885594STim Chenfrom the sibling thread, as level 1 cache and branch target buffer
1286e885594STim Chen(BTB) may be shared between hardware threads in a CPU core.  A malicious
1296e885594STim Chenprogram running on the sibling thread may influence its peer's BTB to
1306e885594STim Chensteer its indirect branch speculations to gadget code, and measure the
1316e885594STim Chenspeculative execution's side effects left in level 1 cache to infer the
1326e885594STim Chenvictim's data.
1336e885594STim Chen
1345ad3eb11SPeter ZijlstraYet another variant 2 attack vector is for the attacker to poison the
1355ad3eb11SPeter ZijlstraBranch History Buffer (BHB) to speculatively steer an indirect branch
1365ad3eb11SPeter Zijlstrato a specific Branch Target Buffer (BTB) entry, even if the entry isn't
1375ad3eb11SPeter Zijlstraassociated with the source address of the indirect branch. Specifically,
1385ad3eb11SPeter Zijlstrathe BHB might be shared across privilege levels even in the presence of
1395ad3eb11SPeter ZijlstraEnhanced IBRS.
1405ad3eb11SPeter Zijlstra
141ec9404e4SPawan GuptaPreviously the only known real-world BHB attack vector was via unprivileged
142ec9404e4SPawan GuptaeBPF. Further research has found attacks that don't require unprivileged eBPF.
143ec9404e4SPawan GuptaFor a full mitigation against BHB attacks it is recommended to set BHI_DIS_S or
144ec9404e4SPawan Guptause the BHB clearing sequence.
1455ad3eb11SPeter Zijlstra
1466e885594STim ChenAttack scenarios
1476e885594STim Chen----------------
1486e885594STim Chen
1496e885594STim ChenThe following list of attack scenarios have been anticipated, but may
1506e885594STim Chennot cover all possible attack vectors.
1516e885594STim Chen
1526e885594STim Chen1. A user process attacking the kernel
1536e885594STim Chen^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1546e885594STim Chen
1554c920576SJosh PoimboeufSpectre variant 1
1564c920576SJosh Poimboeuf~~~~~~~~~~~~~~~~~
1574c920576SJosh Poimboeuf
1586e885594STim Chen   The attacker passes a parameter to the kernel via a register or
1596e885594STim Chen   via a known address in memory during a syscall. Such parameter may
1606e885594STim Chen   be used later by the kernel as an index to an array or to derive
1616e885594STim Chen   a pointer for a Spectre variant 1 attack.  The index or pointer
1626e885594STim Chen   is invalid, but bound checks are bypassed in the code branch taken
1636e885594STim Chen   for speculative execution. This could cause privileged memory to be
1646e885594STim Chen   accessed and leaked.
1656e885594STim Chen
1666e885594STim Chen   For kernel code that has been identified where data pointers could
1676e885594STim Chen   potentially be influenced for Spectre attacks, new "nospec" accessor
1686e885594STim Chen   macros are used to prevent speculative loading of data.
1696e885594STim Chen
1704c920576SJosh PoimboeufSpectre variant 1 (swapgs)
1714c920576SJosh Poimboeuf~~~~~~~~~~~~~~~~~~~~~~~~~~
1724c920576SJosh Poimboeuf
1734c920576SJosh Poimboeuf   An attacker can train the branch predictor to speculatively skip the
1744c920576SJosh Poimboeuf   swapgs path for an interrupt or exception.  If they initialize
1754c920576SJosh Poimboeuf   the GS register to a user-space value, if the swapgs is speculatively
1764c920576SJosh Poimboeuf   skipped, subsequent GS-related percpu accesses in the speculation
1774c920576SJosh Poimboeuf   window will be done with the attacker-controlled GS value.  This
1784c920576SJosh Poimboeuf   could cause privileged memory to be accessed and leaked.
1794c920576SJosh Poimboeuf
1804c920576SJosh Poimboeuf   For example:
1814c920576SJosh Poimboeuf
1824c920576SJosh Poimboeuf   ::
1834c920576SJosh Poimboeuf
1844c920576SJosh Poimboeuf     if (coming from user space)
1854c920576SJosh Poimboeuf         swapgs
1864c920576SJosh Poimboeuf     mov %gs:<percpu_offset>, %reg
1874c920576SJosh Poimboeuf     mov (%reg), %reg1
1884c920576SJosh Poimboeuf
1894c920576SJosh Poimboeuf   When coming from user space, the CPU can speculatively skip the
1904c920576SJosh Poimboeuf   swapgs, and then do a speculative percpu load using the user GS
1914c920576SJosh Poimboeuf   value.  So the user can speculatively force a read of any kernel
1924c920576SJosh Poimboeuf   value.  If a gadget exists which uses the percpu value as an address
1934c920576SJosh Poimboeuf   in another load/store, then the contents of the kernel value may
1944c920576SJosh Poimboeuf   become visible via an L1 side channel attack.
1954c920576SJosh Poimboeuf
1964c920576SJosh Poimboeuf   A similar attack exists when coming from kernel space.  The CPU can
1974c920576SJosh Poimboeuf   speculatively do the swapgs, causing the user GS to get used for the
1984c920576SJosh Poimboeuf   rest of the speculative window.
1994c920576SJosh Poimboeuf
2004c920576SJosh PoimboeufSpectre variant 2
2014c920576SJosh Poimboeuf~~~~~~~~~~~~~~~~~
2024c920576SJosh Poimboeuf
2034c920576SJosh Poimboeuf   A spectre variant 2 attacker can :ref:`poison <poison_btb>` the branch
2046e885594STim Chen   target buffer (BTB) before issuing syscall to launch an attack.
2056e885594STim Chen   After entering the kernel, the kernel could use the poisoned branch
2066e885594STim Chen   target buffer on indirect jump and jump to gadget code in speculative
2076e885594STim Chen   execution.
2086e885594STim Chen
2096e885594STim Chen   If an attacker tries to control the memory addresses leaked during
2106e885594STim Chen   speculative execution, he would also need to pass a parameter to the
2116e885594STim Chen   gadget, either through a register or a known address in memory. After
2126e885594STim Chen   the gadget has executed, he can measure the side effect.
2136e885594STim Chen
2146e885594STim Chen   The kernel can protect itself against consuming poisoned branch
2156e885594STim Chen   target buffer entries by using return trampolines (also known as
2166e885594STim Chen   "retpoline") :ref:`[3] <spec_ref3>` :ref:`[9] <spec_ref9>` for all
2176e885594STim Chen   indirect branches. Return trampolines trap speculative execution paths
2186e885594STim Chen   to prevent jumping to gadget code during speculative execution.
2196e885594STim Chen   x86 CPUs with Enhanced Indirect Branch Restricted Speculation
2206e885594STim Chen   (Enhanced IBRS) available in hardware should use the feature to
2216e885594STim Chen   mitigate Spectre variant 2 instead of retpoline. Enhanced IBRS is
2226e885594STim Chen   more efficient than retpoline.
2236e885594STim Chen
2246e885594STim Chen   There may be gadget code in firmware which could be exploited with
2256e885594STim Chen   Spectre variant 2 attack by a rogue user process. To mitigate such
2266e885594STim Chen   attacks on x86, Indirect Branch Restricted Speculation (IBRS) feature
2276e885594STim Chen   is turned on before the kernel invokes any firmware code.
2286e885594STim Chen
2296e885594STim Chen2. A user process attacking another user process
2306e885594STim Chen^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2316e885594STim Chen
2326e885594STim Chen   A malicious user process can try to attack another user process,
2336e885594STim Chen   either via a context switch on the same hardware thread, or from the
2346e885594STim Chen   sibling hyperthread sharing a physical processor core on simultaneous
2356e885594STim Chen   multi-threading (SMT) system.
2366e885594STim Chen
2376e885594STim Chen   Spectre variant 1 attacks generally require passing parameters
2386e885594STim Chen   between the processes, which needs a data passing relationship, such
2396e885594STim Chen   as remote procedure calls (RPC).  Those parameters are used in gadget
2406e885594STim Chen   code to derive invalid data pointers accessing privileged memory in
2416e885594STim Chen   the attacked process.
2426e885594STim Chen
2436e885594STim Chen   Spectre variant 2 attacks can be launched from a rogue process by
2446e885594STim Chen   :ref:`poisoning <poison_btb>` the branch target buffer.  This can
2456e885594STim Chen   influence the indirect branch targets for a victim process that either
2466e885594STim Chen   runs later on the same hardware thread, or running concurrently on
2476e885594STim Chen   a sibling hardware thread sharing the same physical core.
2486e885594STim Chen
2496e885594STim Chen   A user process can protect itself against Spectre variant 2 attacks
2506e885594STim Chen   by using the prctl() syscall to disable indirect branch speculation
2516e885594STim Chen   for itself.  An administrator can also cordon off an unsafe process
2526e885594STim Chen   from polluting the branch target buffer by disabling the process's
2536e885594STim Chen   indirect branch speculation. This comes with a performance cost
2546e885594STim Chen   from not using indirect branch speculation and clearing the branch
2556e885594STim Chen   target buffer.  When SMT is enabled on x86, for a process that has
2566e885594STim Chen   indirect branch speculation disabled, Single Threaded Indirect Branch
2576e885594STim Chen   Predictors (STIBP) :ref:`[4] <spec_ref4>` are turned on to prevent the
2586e885594STim Chen   sibling thread from controlling branch target buffer.  In addition,
2596e885594STim Chen   the Indirect Branch Prediction Barrier (IBPB) is issued to clear the
2606e885594STim Chen   branch target buffer when context switching to and from such process.
2616e885594STim Chen
2626e885594STim Chen   On x86, the return stack buffer is stuffed on context switch.
2636e885594STim Chen   This prevents the branch target buffer from being used for branch
2646e885594STim Chen   prediction when the return stack buffer underflows while switching to
2656e885594STim Chen   a deeper call stack. Any poisoned entries in the return stack buffer
2666e885594STim Chen   left by the previous process will also be cleared.
2676e885594STim Chen
2686e885594STim Chen   User programs should use address space randomization to make attacks
2696e885594STim Chen   more difficult (Set /proc/sys/kernel/randomize_va_space = 1 or 2).
2706e885594STim Chen
2716e885594STim Chen3. A virtualized guest attacking the host
2726e885594STim Chen^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2736e885594STim Chen
2746e885594STim Chen   The attack mechanism is similar to how user processes attack the
2756e885594STim Chen   kernel.  The kernel is entered via hyper-calls or other virtualization
2766e885594STim Chen   exit paths.
2776e885594STim Chen
2786e885594STim Chen   For Spectre variant 1 attacks, rogue guests can pass parameters
2796e885594STim Chen   (e.g. in registers) via hyper-calls to derive invalid pointers to
2806e885594STim Chen   speculate into privileged memory after entering the kernel.  For places
2816e885594STim Chen   where such kernel code has been identified, nospec accessor macros
2826e885594STim Chen   are used to stop speculative memory access.
2836e885594STim Chen
2846e885594STim Chen   For Spectre variant 2 attacks, rogue guests can :ref:`poison
2856e885594STim Chen   <poison_btb>` the branch target buffer or return stack buffer, causing
2866e885594STim Chen   the kernel to jump to gadget code in the speculative execution paths.
2876e885594STim Chen
2886e885594STim Chen   To mitigate variant 2, the host kernel can use return trampolines
2896e885594STim Chen   for indirect branches to bypass the poisoned branch target buffer,
2906e885594STim Chen   and flushing the return stack buffer on VM exit.  This prevents rogue
2916e885594STim Chen   guests from affecting indirect branching in the host kernel.
2926e885594STim Chen
2936e885594STim Chen   To protect host processes from rogue guests, host processes can have
2946e885594STim Chen   indirect branch speculation disabled via prctl().  The branch target
2956e885594STim Chen   buffer is cleared before context switching to such processes.
2966e885594STim Chen
2976e885594STim Chen4. A virtualized guest attacking other guest
2986e885594STim Chen^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2996e885594STim Chen
3006e885594STim Chen   A rogue guest may attack another guest to get data accessible by the
3016e885594STim Chen   other guest.
3026e885594STim Chen
3036e885594STim Chen   Spectre variant 1 attacks are possible if parameters can be passed
3046e885594STim Chen   between guests.  This may be done via mechanisms such as shared memory
3056e885594STim Chen   or message passing.  Such parameters could be used to derive data
3066e885594STim Chen   pointers to privileged data in guest.  The privileged data could be
3076e885594STim Chen   accessed by gadget code in the victim's speculation paths.
3086e885594STim Chen
3096e885594STim Chen   Spectre variant 2 attacks can be launched from a rogue guest by
3106e885594STim Chen   :ref:`poisoning <poison_btb>` the branch target buffer or the return
3116e885594STim Chen   stack buffer. Such poisoned entries could be used to influence
3126e885594STim Chen   speculation execution paths in the victim guest.
3136e885594STim Chen
3146e885594STim Chen   Linux kernel mitigates attacks to other guests running in the same
3156e885594STim Chen   CPU hardware thread by flushing the return stack buffer on VM exit,
3166e885594STim Chen   and clearing the branch target buffer before switching to a new guest.
3176e885594STim Chen
3186e885594STim Chen   If SMT is used, Spectre variant 2 attacks from an untrusted guest
3196e885594STim Chen   in the sibling hyperthread can be mitigated by the administrator,
3206e885594STim Chen   by turning off the unsafe guest's indirect branch speculation via
3216e885594STim Chen   prctl().  A guest can also protect itself by turning on microcode
3226e885594STim Chen   based mitigations (such as IBPB or STIBP on x86) within the guest.
3236e885594STim Chen
3246e885594STim Chen.. _spectre_sys_info:
3256e885594STim Chen
3266e885594STim ChenSpectre system information
3276e885594STim Chen--------------------------
3286e885594STim Chen
3296e885594STim ChenThe Linux kernel provides a sysfs interface to enumerate the current
3306e885594STim Chenmitigation status of the system for Spectre: whether the system is
3316e885594STim Chenvulnerable, and which mitigations are active.
3326e885594STim Chen
3336e885594STim ChenThe sysfs file showing Spectre variant 1 mitigation status is:
3346e885594STim Chen
3356e885594STim Chen   /sys/devices/system/cpu/vulnerabilities/spectre_v1
3366e885594STim Chen
3376e885594STim ChenThe possible values in this file are:
3386e885594STim Chen
3394c920576SJosh Poimboeuf  .. list-table::
3404c920576SJosh Poimboeuf
3414c920576SJosh Poimboeuf     * - 'Not affected'
3424c920576SJosh Poimboeuf       - The processor is not vulnerable.
3434c920576SJosh Poimboeuf     * - 'Vulnerable: __user pointer sanitization and usercopy barriers only; no swapgs barriers'
3444c920576SJosh Poimboeuf       - The swapgs protections are disabled; otherwise it has
3454c920576SJosh Poimboeuf         protection in the kernel on a case by case base with explicit
3464c920576SJosh Poimboeuf         pointer sanitation and usercopy LFENCE barriers.
3474c920576SJosh Poimboeuf     * - 'Mitigation: usercopy/swapgs barriers and __user pointer sanitization'
3484c920576SJosh Poimboeuf       - Protection in the kernel on a case by case base with explicit
3494c920576SJosh Poimboeuf         pointer sanitation, usercopy LFENCE barriers, and swapgs LFENCE
3504c920576SJosh Poimboeuf         barriers.
3516e885594STim Chen
3526e885594STim ChenHowever, the protections are put in place on a case by case basis,
3536e885594STim Chenand there is no guarantee that all possible attack vectors for Spectre
3546e885594STim Chenvariant 1 are covered.
3556e885594STim Chen
3566e885594STim ChenThe spectre_v2 kernel file reports if the kernel has been compiled with
3576e885594STim Chenretpoline mitigation or if the CPU has hardware mitigation, and if the
3586e885594STim ChenCPU has support for additional process-specific mitigation.
3596e885594STim Chen
3606e885594STim ChenThis file also reports CPU features enabled by microcode to mitigate
3616e885594STim Chenattack between user processes:
3626e885594STim Chen
3636e885594STim Chen1. Indirect Branch Prediction Barrier (IBPB) to add additional
3646e885594STim Chen   isolation between processes of different users.
3656e885594STim Chen2. Single Thread Indirect Branch Predictors (STIBP) to add additional
3666e885594STim Chen   isolation between CPU threads running on the same core.
3676e885594STim Chen
3686e885594STim ChenThese CPU features may impact performance when used and can be enabled
3696e885594STim Chenper process on a case-by-case base.
3706e885594STim Chen
3716e885594STim ChenThe sysfs file showing Spectre variant 2 mitigation status is:
3726e885594STim Chen
3736e885594STim Chen   /sys/devices/system/cpu/vulnerabilities/spectre_v2
3746e885594STim Chen
3756e885594STim ChenThe possible values in this file are:
3766e885594STim Chen
3776e885594STim Chen  - Kernel status:
3786e885594STim Chen
3795ad3eb11SPeter Zijlstra  ========================================  =================================
3806e885594STim Chen  'Not affected'                            The processor is not vulnerable
3815ad3eb11SPeter Zijlstra  'Mitigation: None'                        Vulnerable, no mitigation
3825ad3eb11SPeter Zijlstra  'Mitigation: Retpolines'                  Use Retpoline thunks
3835ad3eb11SPeter Zijlstra  'Mitigation: LFENCE'                      Use LFENCE instructions
3846e885594STim Chen  'Mitigation: Enhanced IBRS'               Hardware-focused mitigation
3855ad3eb11SPeter Zijlstra  'Mitigation: Enhanced IBRS + Retpolines'  Hardware-focused + Retpolines
3865ad3eb11SPeter Zijlstra  'Mitigation: Enhanced IBRS + LFENCE'      Hardware-focused + LFENCE
3875ad3eb11SPeter Zijlstra  ========================================  =================================
3886e885594STim Chen
3896e885594STim Chen  - Firmware status: Show if Indirect Branch Restricted Speculation (IBRS) is
3906e885594STim Chen    used to protect against Spectre variant 2 attacks when calling firmware (x86 only).
3916e885594STim Chen
3926e885594STim Chen  ========== =============================================================
3936e885594STim Chen  'IBRS_FW'  Protection against user program attacks when calling firmware
3946e885594STim Chen  ========== =============================================================
3956e885594STim Chen
3966e885594STim Chen  - Indirect branch prediction barrier (IBPB) status for protection between
3976e885594STim Chen    processes of different users. This feature can be controlled through
3986e885594STim Chen    prctl() per process, or through kernel command line options. This is
3996e885594STim Chen    an x86 only feature. For more details see below.
4006e885594STim Chen
4016e885594STim Chen  ===================   ========================================================
4026e885594STim Chen  'IBPB: disabled'      IBPB unused
4036e885594STim Chen  'IBPB: always-on'     Use IBPB on all tasks
4046e885594STim Chen  'IBPB: conditional'   Use IBPB on SECCOMP or indirect branch restricted tasks
4056e885594STim Chen  ===================   ========================================================
4066e885594STim Chen
4076e885594STim Chen  - Single threaded indirect branch prediction (STIBP) status for protection
4086e885594STim Chen    between different hyper threads. This feature can be controlled through
4096e885594STim Chen    prctl per process, or through kernel command line options. This is x86
4106e885594STim Chen    only feature. For more details see below.
4116e885594STim Chen
4126e885594STim Chen  ====================  ========================================================
4136e885594STim Chen  'STIBP: disabled'     STIBP unused
4146e885594STim Chen  'STIBP: forced'       Use STIBP on all tasks
4156e885594STim Chen  'STIBP: conditional'  Use STIBP on SECCOMP or indirect branch restricted tasks
4166e885594STim Chen  ====================  ========================================================
4176e885594STim Chen
4186e885594STim Chen  - Return stack buffer (RSB) protection status:
4196e885594STim Chen
4206e885594STim Chen  =============   ===========================================
4216e885594STim Chen  'RSB filling'   Protection of RSB on context switch enabled
4226e885594STim Chen  =============   ===========================================
4236e885594STim Chen
4242b129932SDaniel Sneddon  - EIBRS Post-barrier Return Stack Buffer (PBRSB) protection status:
4252b129932SDaniel Sneddon
4262b129932SDaniel Sneddon  ===========================  =======================================================
4272b129932SDaniel Sneddon  'PBRSB-eIBRS: SW sequence'   CPU is affected and protection of RSB on VMEXIT enabled
4282b129932SDaniel Sneddon  'PBRSB-eIBRS: Vulnerable'    CPU is vulnerable
4292b129932SDaniel Sneddon  'PBRSB-eIBRS: Not affected'  CPU is not affected by PBRSB
4302b129932SDaniel Sneddon  ===========================  =======================================================
4312b129932SDaniel Sneddon
432ec9404e4SPawan Gupta  - Branch History Injection (BHI) protection status:
433ec9404e4SPawan Gupta
434ec9404e4SPawan Gupta.. list-table::
435ec9404e4SPawan Gupta
436ec9404e4SPawan Gupta * - BHI: Not affected
437ec9404e4SPawan Gupta   - System is not affected
438ec9404e4SPawan Gupta * - BHI: Retpoline
439ec9404e4SPawan Gupta   - System is protected by retpoline
440ec9404e4SPawan Gupta * - BHI: BHI_DIS_S
441ec9404e4SPawan Gupta   - System is protected by BHI_DIS_S
442dfe64890SJosh Poimboeuf * - BHI: SW loop, KVM SW loop
443ec9404e4SPawan Gupta   - System is protected by software clearing sequence
444*5f882f3bSJosh Poimboeuf * - BHI: Vulnerable
445*5f882f3bSJosh Poimboeuf   - System is vulnerable to BHI
446*5f882f3bSJosh Poimboeuf * - BHI: Vulnerable, KVM: SW loop
447*5f882f3bSJosh Poimboeuf   - System is vulnerable; KVM is protected by software clearing sequence
448ec9404e4SPawan Gupta
4496e885594STim ChenFull mitigation might require a microcode update from the CPU
4506e885594STim Chenvendor. When the necessary microcode is not available, the kernel will
4516e885594STim Chenreport vulnerability.
4526e885594STim Chen
4536e885594STim ChenTurning on mitigation for Spectre variant 1 and Spectre variant 2
4546e885594STim Chen-----------------------------------------------------------------
4556e885594STim Chen
4566e885594STim Chen1. Kernel mitigation
4576e885594STim Chen^^^^^^^^^^^^^^^^^^^^
4586e885594STim Chen
4594c920576SJosh PoimboeufSpectre variant 1
4604c920576SJosh Poimboeuf~~~~~~~~~~~~~~~~~
4614c920576SJosh Poimboeuf
4626e885594STim Chen   For the Spectre variant 1, vulnerable kernel code (as determined
4636e885594STim Chen   by code audit or scanning tools) is annotated on a case by case
4646e885594STim Chen   basis to use nospec accessor macros for bounds clipping :ref:`[2]
4656e885594STim Chen   <spec_ref2>` to avoid any usable disclosure gadgets. However, it may
4666e885594STim Chen   not cover all attack vectors for Spectre variant 1.
4676e885594STim Chen
4684c920576SJosh Poimboeuf   Copy-from-user code has an LFENCE barrier to prevent the access_ok()
4694c920576SJosh Poimboeuf   check from being mis-speculated.  The barrier is done by the
4704c920576SJosh Poimboeuf   barrier_nospec() macro.
4714c920576SJosh Poimboeuf
4724c920576SJosh Poimboeuf   For the swapgs variant of Spectre variant 1, LFENCE barriers are
4734c920576SJosh Poimboeuf   added to interrupt, exception and NMI entry where needed.  These
4744c920576SJosh Poimboeuf   barriers are done by the FENCE_SWAPGS_KERNEL_ENTRY and
4754c920576SJosh Poimboeuf   FENCE_SWAPGS_USER_ENTRY macros.
4764c920576SJosh Poimboeuf
4774c920576SJosh PoimboeufSpectre variant 2
4784c920576SJosh Poimboeuf~~~~~~~~~~~~~~~~~
4794c920576SJosh Poimboeuf
4806e885594STim Chen   For Spectre variant 2 mitigation, the compiler turns indirect calls or
4816e885594STim Chen   jumps in the kernel into equivalent return trampolines (retpolines)
4826e885594STim Chen   :ref:`[3] <spec_ref3>` :ref:`[9] <spec_ref9>` to go to the target
4836e885594STim Chen   addresses.  Speculative execution paths under retpolines are trapped
4846e885594STim Chen   in an infinite loop to prevent any speculative execution jumping to
4856e885594STim Chen   a gadget.
4866e885594STim Chen
4876e885594STim Chen   To turn on retpoline mitigation on a vulnerable CPU, the kernel
4886e885594STim Chen   needs to be compiled with a gcc compiler that supports the
4896e885594STim Chen   -mindirect-branch=thunk-extern -mindirect-branch-register options.
4906e885594STim Chen   If the kernel is compiled with a Clang compiler, the compiler needs
4916e885594STim Chen   to support -mretpoline-external-thunk option.  The kernel config
492aefb2f2eSBreno Leitao   CONFIG_MITIGATION_RETPOLINE needs to be turned on, and the CPU needs
493aefb2f2eSBreno Leitao   to run with the latest updated microcode.
4946e885594STim Chen
4956e885594STim Chen   On Intel Skylake-era systems the mitigation covers most, but not all,
4966e885594STim Chen   cases. See :ref:`[3] <spec_ref3>` for more details.
4976e885594STim Chen
498e02b50caSKP Singh   On CPUs with hardware mitigation for Spectre variant 2 (e.g. IBRS
499e02b50caSKP Singh   or enhanced IBRS on x86), retpoline is automatically disabled at run time.
500e02b50caSKP Singh
501e02b50caSKP Singh   Systems which support enhanced IBRS (eIBRS) enable IBRS protection once at
502e02b50caSKP Singh   boot, by setting the IBRS bit, and they're automatically protected against
503ec9404e4SPawan Gupta   some Spectre v2 variant attacks. The BHB can still influence the choice of
504ec9404e4SPawan Gupta   indirect branch predictor entry, and although branch predictor entries are
505ec9404e4SPawan Gupta   isolated between modes when eIBRS is enabled, the BHB itself is not isolated
506ec9404e4SPawan Gupta   between modes. Systems which support BHI_DIS_S will set it to protect against
507ec9404e4SPawan Gupta   BHI attacks.
508e02b50caSKP Singh
509fd470a8bSKim Phillips   On Intel's enhanced IBRS systems, this includes cross-thread branch target
510fd470a8bSKim Phillips   injections on SMT systems (STIBP). In other words, Intel eIBRS enables
511fd470a8bSKim Phillips   STIBP, too.
512fd470a8bSKim Phillips
513fd470a8bSKim Phillips   AMD Automatic IBRS does not protect userspace, and Legacy IBRS systems clear
514fd470a8bSKim Phillips   the IBRS bit on exit to userspace, therefore both explicitly enable STIBP.
5156e885594STim Chen
5166e885594STim Chen   The retpoline mitigation is turned on by default on vulnerable
5176e885594STim Chen   CPUs. It can be forced on or off by the administrator
5186e885594STim Chen   via the kernel command line and sysfs control files. See
5196e885594STim Chen   :ref:`spectre_mitigation_control_command_line`.
5206e885594STim Chen
5216e885594STim Chen   On x86, indirect branch restricted speculation is turned on by default
5226e885594STim Chen   before invoking any firmware code to prevent Spectre variant 2 exploits
5236e885594STim Chen   using the firmware.
5246e885594STim Chen
52582ca6732SLukas Bulwahn   Using kernel address space randomization (CONFIG_RANDOMIZE_BASE=y
5266e885594STim Chen   and CONFIG_SLAB_FREELIST_RANDOM=y in the kernel configuration) makes
5276e885594STim Chen   attacks on the kernel generally more difficult.
5286e885594STim Chen
5296e885594STim Chen2. User program mitigation
5306e885594STim Chen^^^^^^^^^^^^^^^^^^^^^^^^^^
5316e885594STim Chen
5326e885594STim Chen   User programs can mitigate Spectre variant 1 using LFENCE or "bounds
5336e885594STim Chen   clipping". For more details see :ref:`[2] <spec_ref2>`.
5346e885594STim Chen
5356e885594STim Chen   For Spectre variant 2 mitigation, individual user programs
5366e885594STim Chen   can be compiled with return trampolines for indirect branches.
5376e885594STim Chen   This protects them from consuming poisoned entries in the branch
538e02b50caSKP Singh   target buffer left by malicious software.
539e02b50caSKP Singh
540e02b50caSKP Singh   On legacy IBRS systems, at return to userspace, implicit STIBP is disabled
541e02b50caSKP Singh   because the kernel clears the IBRS bit. In this case, the userspace programs
542e02b50caSKP Singh   can disable indirect branch speculation via prctl() (See
543e02b50caSKP Singh   :ref:`Documentation/userspace-api/spec_ctrl.rst <set_spec_ctrl>`).
5446e885594STim Chen   On x86, this will turn on STIBP to guard against attacks from the
5456e885594STim Chen   sibling thread when the user program is running, and use IBPB to
5466e885594STim Chen   flush the branch target buffer when switching to/from the program.
5476e885594STim Chen
5486e885594STim Chen   Restricting indirect branch speculation on a user program will
5496e885594STim Chen   also prevent the program from launching a variant 2 attack
5502f46993dSAndrea Arcangeli   on x86.  Administrators can change that behavior via the kernel
5512f46993dSAndrea Arcangeli   command line and sysfs control files.
5526e885594STim Chen   See :ref:`spectre_mitigation_control_command_line`.
5536e885594STim Chen
5546e885594STim Chen   Programs that disable their indirect branch speculation will have
5556e885594STim Chen   more overhead and run slower.
5566e885594STim Chen
5576e885594STim Chen   User programs should use address space randomization
5586e885594STim Chen   (/proc/sys/kernel/randomize_va_space = 1 or 2) to make attacks more
5596e885594STim Chen   difficult.
5606e885594STim Chen
5616e885594STim Chen3. VM mitigation
5626e885594STim Chen^^^^^^^^^^^^^^^^
5636e885594STim Chen
5646e885594STim Chen   Within the kernel, Spectre variant 1 attacks from rogue guests are
5656e885594STim Chen   mitigated on a case by case basis in VM exit paths. Vulnerable code
5666e885594STim Chen   uses nospec accessor macros for "bounds clipping", to avoid any
5676e885594STim Chen   usable disclosure gadgets.  However, this may not cover all variant
5686e885594STim Chen   1 attack vectors.
5696e885594STim Chen
5706e885594STim Chen   For Spectre variant 2 attacks from rogue guests to the kernel, the
5716e885594STim Chen   Linux kernel uses retpoline or Enhanced IBRS to prevent consumption of
5726e885594STim Chen   poisoned entries in branch target buffer left by rogue guests.  It also
5736e885594STim Chen   flushes the return stack buffer on every VM exit to prevent a return
5746e885594STim Chen   stack buffer underflow so poisoned branch target buffer could be used,
5756e885594STim Chen   or attacker guests leaving poisoned entries in the return stack buffer.
5766e885594STim Chen
5776e885594STim Chen   To mitigate guest-to-guest attacks in the same CPU hardware thread,
5786e885594STim Chen   the branch target buffer is sanitized by flushing before switching
5796e885594STim Chen   to a new guest on a CPU.
5806e885594STim Chen
5816e885594STim Chen   The above mitigations are turned on by default on vulnerable CPUs.
5826e885594STim Chen
5836e885594STim Chen   To mitigate guest-to-guest attacks from sibling thread when SMT is
5846e885594STim Chen   in use, an untrusted guest running in the sibling thread can have
5856e885594STim Chen   its indirect branch speculation disabled by administrator via prctl().
5866e885594STim Chen
5876e885594STim Chen   The kernel also allows guests to use any microcode based mitigation
5886e885594STim Chen   they choose to use (such as IBPB or STIBP on x86) to protect themselves.
5896e885594STim Chen
5906e885594STim Chen.. _spectre_mitigation_control_command_line:
5916e885594STim Chen
5926e885594STim ChenMitigation control on the kernel command line
5936e885594STim Chen---------------------------------------------
5946e885594STim Chen
5956e885594STim ChenSpectre variant 2 mitigation can be disabled or force enabled at the
5966e885594STim Chenkernel command line.
5976e885594STim Chen
5984c920576SJosh Poimboeuf	nospectre_v1
5994c920576SJosh Poimboeuf
6004c920576SJosh Poimboeuf		[X86,PPC] Disable mitigations for Spectre Variant 1
6014c920576SJosh Poimboeuf		(bounds check bypass). With this option data leaks are
6024c920576SJosh Poimboeuf		possible in the system.
6034c920576SJosh Poimboeuf
6046e885594STim Chen	nospectre_v2
6056e885594STim Chen
6066e885594STim Chen		[X86] Disable all mitigations for the Spectre variant 2
6076e885594STim Chen		(indirect branch prediction) vulnerability. System may
6086e885594STim Chen		allow data leaks with this option, which is equivalent
6096e885594STim Chen		to spectre_v2=off.
6106e885594STim Chen
6116e885594STim Chen
6126e885594STim Chen        spectre_v2=
6136e885594STim Chen
6146e885594STim Chen		[X86] Control mitigation of Spectre variant 2
6156e885594STim Chen		(indirect branch speculation) vulnerability.
6166e885594STim Chen		The default operation protects the kernel from
6176e885594STim Chen		user space attacks.
6186e885594STim Chen
6196e885594STim Chen		on
6206e885594STim Chen			unconditionally enable, implies
6216e885594STim Chen			spectre_v2_user=on
6226e885594STim Chen		off
6236e885594STim Chen			unconditionally disable, implies
6246e885594STim Chen		        spectre_v2_user=off
6256e885594STim Chen		auto
6266e885594STim Chen			kernel detects whether your CPU model is
6276e885594STim Chen		        vulnerable
6286e885594STim Chen
6296e885594STim Chen		Selecting 'on' will, and 'auto' may, choose a
6306e885594STim Chen		mitigation method at run time according to the
6316e885594STim Chen		CPU, the available microcode, the setting of the
632aefb2f2eSBreno Leitao		CONFIG_MITIGATION_RETPOLINE configuration option,
633aefb2f2eSBreno Leitao		and the compiler with which the kernel was built.
6346e885594STim Chen
6356e885594STim Chen		Selecting 'on' will also enable the mitigation
6366e885594STim Chen		against user space to user space task attacks.
6376e885594STim Chen
6386e885594STim Chen		Selecting 'off' will disable both the kernel and
6396e885594STim Chen		the user space protections.
6406e885594STim Chen
6416e885594STim Chen		Specific mitigations can also be selected manually:
6426e885594STim Chen
6435ad3eb11SPeter Zijlstra                retpoline               auto pick between generic,lfence
6445ad3eb11SPeter Zijlstra                retpoline,generic       Retpolines
6455ad3eb11SPeter Zijlstra                retpoline,lfence        LFENCE; indirect branch
6465ad3eb11SPeter Zijlstra                retpoline,amd           alias for retpoline,lfence
647e7862edaSKim Phillips                eibrs                   Enhanced/Auto IBRS
648e7862edaSKim Phillips                eibrs,retpoline         Enhanced/Auto IBRS + Retpolines
649e7862edaSKim Phillips                eibrs,lfence            Enhanced/Auto IBRS + LFENCE
65006cb31ccSLin Yujun                ibrs                    use IBRS to protect kernel
6516e885594STim Chen
6526e885594STim Chen		Not specifying this option is equivalent to
6536e885594STim Chen		spectre_v2=auto.
6546e885594STim Chen
6556e885594STim Chen		In general the kernel by default selects
6566e885594STim Chen		reasonable mitigations for the current CPU. To
6576e885594STim Chen		disable Spectre variant 2 mitigations, boot with
6586e885594STim Chen		spectre_v2=off. Spectre variant 1 mitigations
6596e885594STim Chen		cannot be disabled.
6606e885594STim Chen
661ec9404e4SPawan Gupta	spectre_bhi=
662ec9404e4SPawan Gupta
663ec9404e4SPawan Gupta		[X86] Control mitigation of Branch History Injection
664*5f882f3bSJosh Poimboeuf		(BHI) vulnerability.  This setting affects the deployment
665ec9404e4SPawan Gupta		of the HW BHI control and the SW BHB clearing sequence.
666ec9404e4SPawan Gupta
667ec9404e4SPawan Gupta		on
668dfe64890SJosh Poimboeuf			(default) Enable the HW or SW mitigation as
669dfe64890SJosh Poimboeuf			needed.
670ec9404e4SPawan Gupta		off
671dfe64890SJosh Poimboeuf			Disable the mitigation.
672ec9404e4SPawan Gupta
6735ad3eb11SPeter ZijlstraFor spectre_v2_user see Documentation/admin-guide/kernel-parameters.txt
674d9bbdbf3SAndrea Arcangeli
6756e885594STim ChenMitigation selection guide
6766e885594STim Chen--------------------------
6776e885594STim Chen
6786e885594STim Chen1. Trusted userspace
6796e885594STim Chen^^^^^^^^^^^^^^^^^^^^
6806e885594STim Chen
6816e885594STim Chen   If all userspace applications are from trusted sources and do not
6826e885594STim Chen   execute externally supplied untrusted code, then the mitigations can
6836e885594STim Chen   be disabled.
6846e885594STim Chen
6856e885594STim Chen2. Protect sensitive programs
6866e885594STim Chen^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6876e885594STim Chen
6886e885594STim Chen   For security-sensitive programs that have secrets (e.g. crypto
6896e885594STim Chen   keys), protection against Spectre variant 2 can be put in place by
6906e885594STim Chen   disabling indirect branch speculation when the program is running
6916e885594STim Chen   (See :ref:`Documentation/userspace-api/spec_ctrl.rst <set_spec_ctrl>`).
6926e885594STim Chen
6936e885594STim Chen3. Sandbox untrusted programs
6946e885594STim Chen^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6956e885594STim Chen
6966e885594STim Chen   Untrusted programs that could be a source of attacks can be cordoned
6976e885594STim Chen   off by disabling their indirect branch speculation when they are run
6986e885594STim Chen   (See :ref:`Documentation/userspace-api/spec_ctrl.rst <set_spec_ctrl>`).
6996e885594STim Chen   This prevents untrusted programs from polluting the branch target
7002f46993dSAndrea Arcangeli   buffer.  This behavior can be changed via the kernel command line
7012f46993dSAndrea Arcangeli   and sysfs control files. See
7026e885594STim Chen   :ref:`spectre_mitigation_control_command_line`.
7036e885594STim Chen
7046e885594STim Chen3. High security mode
7056e885594STim Chen^^^^^^^^^^^^^^^^^^^^^
7066e885594STim Chen
7076e885594STim Chen   All Spectre variant 2 mitigations can be forced on
7086e885594STim Chen   at boot time for all programs (See the "on" option in
7096e885594STim Chen   :ref:`spectre_mitigation_control_command_line`).  This will add
7106e885594STim Chen   overhead as indirect branch speculations for all programs will be
7116e885594STim Chen   restricted.
7126e885594STim Chen
7136e885594STim Chen   On x86, branch target buffer will be flushed with IBPB when switching
7146e885594STim Chen   to a new program. STIBP is left on all the time to protect programs
7156e885594STim Chen   against variant 2 attacks originating from programs running on
7166e885594STim Chen   sibling threads.
7176e885594STim Chen
7186e885594STim Chen   Alternatively, STIBP can be used only when running programs
7196e885594STim Chen   whose indirect branch speculation is explicitly disabled,
7206e885594STim Chen   while IBPB is still used all the time when switching to a new
7216e885594STim Chen   program to clear the branch target buffer (See "ibpb" option in
7226e885594STim Chen   :ref:`spectre_mitigation_control_command_line`).  This "ibpb" option
7236e885594STim Chen   has less performance cost than the "on" option, which leaves STIBP
7246e885594STim Chen   on all the time.
7256e885594STim Chen
7266e885594STim ChenReferences on Spectre
7276e885594STim Chen---------------------
7286e885594STim Chen
7296e885594STim ChenIntel white papers:
7306e885594STim Chen
7316e885594STim Chen.. _spec_ref1:
7326e885594STim Chen
7336e885594STim Chen[1] `Intel analysis of speculative execution side channels <https://newsroom.intel.com/wp-content/uploads/sites/11/2018/01/Intel-Analysis-of-Speculative-Execution-Side-Channels.pdf>`_.
7346e885594STim Chen
7356e885594STim Chen.. _spec_ref2:
7366e885594STim Chen
7376e885594STim Chen[2] `Bounds check bypass <https://software.intel.com/security-software-guidance/software-guidance/bounds-check-bypass>`_.
7386e885594STim Chen
7396e885594STim Chen.. _spec_ref3:
7406e885594STim Chen
7416e885594STim Chen[3] `Deep dive: Retpoline: A branch target injection mitigation <https://software.intel.com/security-software-guidance/insights/deep-dive-retpoline-branch-target-injection-mitigation>`_.
7426e885594STim Chen
7436e885594STim Chen.. _spec_ref4:
7446e885594STim Chen
7456e885594STim Chen[4] `Deep Dive: Single Thread Indirect Branch Predictors <https://software.intel.com/security-software-guidance/insights/deep-dive-single-thread-indirect-branch-predictors>`_.
7466e885594STim Chen
7476e885594STim ChenAMD white papers:
7486e885594STim Chen
7496e885594STim Chen.. _spec_ref5:
7506e885594STim Chen
7516e885594STim Chen[5] `AMD64 technology indirect branch control extension <https://developer.amd.com/wp-content/resources/Architecture_Guidelines_Update_Indirect_Branch_Control.pdf>`_.
7526e885594STim Chen
7536e885594STim Chen.. _spec_ref6:
7546e885594STim Chen
755e9b6013aSKim Phillips[6] `Software techniques for managing speculation on AMD processors <https://developer.amd.com/wp-content/resources/Managing-Speculation-on-AMD-Processors.pdf>`_.
7566e885594STim Chen
7576e885594STim ChenARM white papers:
7586e885594STim Chen
7596e885594STim Chen.. _spec_ref7:
7606e885594STim Chen
7616e885594STim Chen[7] `Cache speculation side-channels <https://developer.arm.com/support/arm-security-updates/speculative-processor-vulnerability/download-the-whitepaper>`_.
7626e885594STim Chen
7636e885594STim Chen.. _spec_ref8:
7646e885594STim Chen
7656e885594STim Chen[8] `Cache speculation issues update <https://developer.arm.com/support/arm-security-updates/speculative-processor-vulnerability/latest-updates/cache-speculation-issues-update>`_.
7666e885594STim Chen
7676e885594STim ChenGoogle white paper:
7686e885594STim Chen
7696e885594STim Chen.. _spec_ref9:
7706e885594STim Chen
7716e885594STim Chen[9] `Retpoline: a software construct for preventing branch-target-injection <https://support.google.com/faqs/answer/7625886>`_.
7726e885594STim Chen
7736e885594STim ChenMIPS white paper:
7746e885594STim Chen
7756e885594STim Chen.. _spec_ref10:
7766e885594STim Chen
7776e885594STim Chen[10] `MIPS: response on speculative execution and side channel vulnerabilities <https://www.mips.com/blog/mips-response-on-speculative-execution-and-side-channel-vulnerabilities/>`_.
7786e885594STim Chen
7796e885594STim ChenAcademic papers:
7806e885594STim Chen
7816e885594STim Chen.. _spec_ref11:
7826e885594STim Chen
7836e885594STim Chen[11] `Spectre Attacks: Exploiting Speculative Execution <https://spectreattack.com/spectre.pdf>`_.
7846e885594STim Chen
7856e885594STim Chen.. _spec_ref12:
7866e885594STim Chen
7876e885594STim Chen[12] `NetSpectre: Read Arbitrary Memory over Network <https://arxiv.org/abs/1807.10535>`_.
7886e885594STim Chen
7896e885594STim Chen.. _spec_ref13:
7906e885594STim Chen
7916e885594STim Chen[13] `Spectre Returns! Speculation Attacks using the Return Stack Buffer <https://www.usenix.org/system/files/conference/woot18/woot18-paper-koruyeh.pdf>`_.
792