blob: 4197b974a7a9092a32ec059d1f192e4f1b7c6ece [file] [log] [blame]
Gabor Toth07b5ebf2024-07-01 17:19:27 +02001Supported Architectural Features
2================================
3
4Branch Protection
5-----------------
6
7Branch protection covers two architecture features for mitigating Return Oriented Programming (ROP) and Jump Oriented
8Programming (JOP) attacks. For generic overview of these features please see
9`Providing protection for complex software`_.
10
11Branch Protection related hardware features can not be controlled from S-EL0 and to enable these co-operation with
12components running at higher exception levels is needed. Please refer to the documentation of the these components for
13information on how to enable these HW features.
14
15Pointer Authentication (FEAT_PAUTH)
16'''''''''''''''''''''''''''''''''''
17
18Pointer Authentication (PAC) is an ARMv8.3 feature where the return address of each function is signed. The signature is
19calculated when the function is called and verified upon returning. This is to ensure the return address has not been
20tampered with.
21
22Branch Target Identification (FEAT_BTI)
23'''''''''''''''''''''''''''''''''''''''
24
25Branch Target Identification (BTI) is an ARMv8.5 feature which is used to guard against the execution of instructions
26that are not the intended target of an indirect branch.
27
28For raw-binary SPs the TS build system will will mark the executable regions with the BTI attribute in the SP manifest
29file. The SPMC implementation running the SP is required to support this memory attribute, or has to unconditionally
30enable BTI for all executable regions to get the feature working.
31
32Although GCC has BTI support since v9, no BTI enabled libraries are shipped with the current GNUARM releases. A possible
33workaround is to compile from source as described in the `FAQ section of the OP-TEE documentation`_.
34
35Configuring Branch Protection in the TS build system
36''''''''''''''''''''''''''''''''''''''''''''''''''''
37
38The feature can be controlled using the ``BRANCH_PROTECTION`` variable. This can be set e.g. on the cmake command line
39by passing ``-DBRANCH_PROTECTION=<value>``. The default value is ``unset``. Please refer to `GCC manual`_ for the
40detailed description of the values.
41
42.. list-table:: Supported values of ``BRANCH_PROTECTION``
43 :name: branch_protection_table
44 :header-rows: 1
45
46 * - Value
47 - GCC option
48 - FEAT_PAUTH
49 - FEAT_BTI
50 * - unset
51 -
52 - usually `N` (depends on how GCC is compiled)
53 - usually `N` (depends on how GCC is compiled)
54 * - 0
55 - "none"
56 - N
57 - N
58 * - 1
59 - "standard"
60 - Y
61 - Y
62 * - 2
63 - "pac-ret"
64 - Y
65 - N
66 * - 3
67 - "pac-ret+leaf"
68 - Y
69 - N
70 * - 4
71 - "bti"
72 - N
73 - Y
74
75--------------
76
77.. _`FAQ section of the OP-TEE documentation`: https://optee.readthedocs.io/en/stable/faq/faq.html#faq-gcc-bti
78.. _`Providing protection for complex software` : https://developer.arm.com/documentation/102433/0200
79.. _`GCC Manual`: https://gcc.gnu.org/onlinedocs/gcc-9.1.0/gcc/AArch64-Options.html
80
81*Copyright (c) 2024, Arm Limited and Contributors. All rights reserved.*
82
83SPDX-License-Identifier: BSD-3-Clause