1 .. SPDX-License-Identifier: GPL-2.0-or-later 2 3 ========================================== 4 DEXCR (Dynamic Execution Control Register) 5 ========================================== 6 7 Overview 8 ======== 9 10 The DEXCR is a privileged special purpose regi 11 PowerPC ISA 3.1B (Power10) that allows per-cpu 12 execution behaviours. These behaviours include 13 branch target prediction) and enabling return- 14 protection instructions. 15 16 The execution control is exposed in hardware a 17 the DEXCR. Each aspect controls a certain beha 18 to enable/disable the aspect. There are severa 19 different purposes: 20 21 DEXCR 22 A privileged SPR that can control aspects 23 HDEXCR 24 A hypervisor-privileged SPR that can contr 25 enforce aspects for the kernel and userspa 26 UDEXCR 27 An optional ultravisor-privileged SPR that 28 29 Userspace can examine the current DEXCR state 30 provides a non-privileged read-only view of th 31 There is also an SPR that provides a read-only 32 aspects, which ORed with the userspace DEXCR v 33 state for a process. 34 35 36 Configuration 37 ============= 38 39 prctl 40 ----- 41 42 A process can control its own userspace DEXCR 43 ``PR_PPC_GET_DEXCR`` and ``PR_PPC_SET_DEXCR`` 44 :manpage:`prctl(2)` commands. These calls have 45 46 prctl(PR_PPC_GET_DEXCR, unsigned long whic 47 prctl(PR_PPC_SET_DEXCR, unsigned long whic 48 49 The possible 'which' and 'ctrl' values are as 50 between the 'which' value and the DEXCR aspect 51 52 .. flat-table:: 53 :header-rows: 1 54 :widths: 2 7 1 55 56 * - ``prctl()`` which 57 - Aspect name 58 - Aspect index 59 60 * - ``PR_PPC_DEXCR_SBHE`` 61 - Speculative Branch Hint Enable (SBHE) 62 - 0 63 64 * - ``PR_PPC_DEXCR_IBRTPD`` 65 - Indirect Branch Recurrent Target Predic 66 - 3 67 68 * - ``PR_PPC_DEXCR_SRAPD`` 69 - Subroutine Return Address Prediction Di 70 - 4 71 72 * - ``PR_PPC_DEXCR_NPHIE`` 73 - Non-Privileged Hash Instruction Enable 74 - 5 75 76 .. flat-table:: 77 :header-rows: 1 78 :widths: 2 8 79 80 * - ``prctl()`` ctrl 81 - Meaning 82 83 * - ``PR_PPC_DEXCR_CTRL_EDITABLE`` 84 - This aspect can be configured with PR_P 85 86 * - ``PR_PPC_DEXCR_CTRL_SET`` 87 - This aspect is set / set this aspect 88 89 * - ``PR_PPC_DEXCR_CTRL_CLEAR`` 90 - This aspect is clear / clear this aspec 91 92 * - ``PR_PPC_DEXCR_CTRL_SET_ONEXEC`` 93 - This aspect will be set after exec / se 94 95 * - ``PR_PPC_DEXCR_CTRL_CLEAR_ONEXEC`` 96 - This aspect will be clear after exec / 97 98 Note that 99 100 * which is a plain value, not a bitmask. Aspec 101 102 * ctrl is a bitmask. ``PR_PPC_GET_DEXCR`` retu 103 configuration. For example, ``PR_PPC_GET_DEX 104 ``PR_PPC_DEXCR_CTRL_EDITABLE | PR_PPC_DEXCR_ 105 PR_PPC_DEXCR_CTRL_CLEAR_ONEXEC``. This would 106 set, it will be cleared when you run exec, a 107 ``PR_PPC_SET_DEXCR`` prctl. 108 109 * The set/clear terminology refers to setting/ 110 For example:: 111 112 prctl(PR_PPC_SET_DEXCR, PR_PPC_DEXCR_IBR 113 114 will set the IBRTPD aspect bit in the DEXCR, 115 to be disabled. 116 117 * The status returned by ``PR_PPC_GET_DEXCR`` 118 would like applied. It does not include any 119 the hypervisor is enforcing the aspect be se 120 software should read the appropriate SPRs di 121 122 * The aspect state when starting a process is 123 :manpage:`fork(2)`. The state is reset to a 124 :manpage:`execve(2)`. The PR_PPC_SET_DEXCR p 125 values. 126 127 * The ``*_ONEXEC`` controls do not change the 128 129 Use ``PR_PPC_SET_DEXCR`` with one of ``PR_PPC_ 130 ``PR_PPC_DEXCR_CTRL_CLEAR`` to edit a given as 131 132 Common error codes for both getting and settin 133 134 .. flat-table:: 135 :header-rows: 1 136 :widths: 2 8 137 138 * - Error 139 - Meaning 140 141 * - ``EINVAL`` 142 - The DEXCR is not supported by the kerne 143 144 * - ``ENODEV`` 145 - The aspect is not recognised by the ker 146 hardware. 147 148 ``PR_PPC_SET_DEXCR`` may also report the follo 149 150 .. flat-table:: 151 :header-rows: 1 152 :widths: 2 8 153 154 * - Error 155 - Meaning 156 157 * - ``EINVAL`` 158 - The ctrl value contains unrecognised fl 159 160 * - ``EINVAL`` 161 - The ctrl value contains mutually confli 162 ``PR_PPC_DEXCR_CTRL_SET | PR_PPC_DEXCR_ 163 164 * - ``EPERM`` 165 - This aspect cannot be modified with prc 166 PR_PPC_DEXCR_CTRL_EDITABLE flag with PR 167 168 * - ``EPERM`` 169 - The process does not have sufficient pr 170 For example, clearing NPHIE on exec is 171 can still clear its own NPHIE aspect wi 172 173 This interface allows a process to control its 174 the initial DEXCR value for any children in it 175 child to use an ``*_ONEXEC`` control). This al 176 default value of the DEXCR, for example allowi 177 default values. 178 179 180 coredump and ptrace 181 =================== 182 183 The userspace values of the DEXCR and HDEXCR ( 184 ``NT_PPC_DEXCR``. These are each 64 bits and r 185 assist with core dumps. The DEXCR may be made 186 bits of both registers (corresponding to the n 187 188 If the kernel config ``CONFIG_CHECKPOINT_RESTO 189 ``NT_PPC_HASHKEYR`` is available and exposes t 190 for reading and writing. This is a tradeoff be 191 checkpoint/restore support: a process should n 192 secret key, but restoring a process requires s 193 therefore appears in core dumps, and an attack 194 a coredump and effectively bypass ROP protecti 195 key (potentially all threads from the same par
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.