| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | 
|---|
| 2 |  | 
|---|
| 3 | #include <linux/linkage.h> | 
|---|
| 4 | #include <asm/unwind_hints.h> | 
|---|
| 5 | #include <asm/nospec-branch.h> | 
|---|
| 6 |  | 
|---|
| 7 | /* | 
|---|
| 8 | * Notably, the FineIBT preamble calling these will have ZF set and eax zero. | 
|---|
| 9 | * | 
|---|
| 10 | * The very last element is in fact larger than 32 bytes, but since its the | 
|---|
| 11 | * last element, this does not matter, | 
|---|
| 12 | * | 
|---|
| 13 | * There are 2 #UD sites, located between 0,1-2,3 and 4,5-6,7 such that they | 
|---|
| 14 | * can be reached using Jcc.d8, these elements (1 and 5) have sufficiently | 
|---|
| 15 | * big alignment holes for this to not stagger the array. | 
|---|
| 16 | */ | 
|---|
| 17 |  | 
|---|
| 18 | .pushsection .noinstr.text, "ax" | 
|---|
| 19 |  | 
|---|
| 20 | .align 32 | 
|---|
| 21 | SYM_CODE_START(__bhi_args) | 
|---|
| 22 |  | 
|---|
| 23 | #ifdef CONFIG_FINEIBT_BHI | 
|---|
| 24 |  | 
|---|
| 25 | .align 32 | 
|---|
| 26 | SYM_INNER_LABEL(__bhi_args_0, SYM_L_LOCAL) | 
|---|
| 27 | ANNOTATE_NOENDBR | 
|---|
| 28 | UNWIND_HINT_FUNC | 
|---|
| 29 | jne .Lud_1 | 
|---|
| 30 | ANNOTATE_UNRET_SAFE | 
|---|
| 31 | ret | 
|---|
| 32 | int3 | 
|---|
| 33 |  | 
|---|
| 34 | .align 32 | 
|---|
| 35 | SYM_INNER_LABEL(__bhi_args_1, SYM_L_LOCAL) | 
|---|
| 36 | ANNOTATE_NOENDBR | 
|---|
| 37 | UNWIND_HINT_FUNC | 
|---|
| 38 | jne .Lud_1 | 
|---|
| 39 | cmovne %rax, %rdi | 
|---|
| 40 | ANNOTATE_UNRET_SAFE | 
|---|
| 41 | ret | 
|---|
| 42 | int3 | 
|---|
| 43 |  | 
|---|
| 44 | .align 8 | 
|---|
| 45 | ANNOTATE_REACHABLE | 
|---|
| 46 | .Lud_1:	ud2 | 
|---|
| 47 | ANNOTATE_UNRET_SAFE | 
|---|
| 48 | ret | 
|---|
| 49 | int3 | 
|---|
| 50 |  | 
|---|
| 51 | .align 32 | 
|---|
| 52 | SYM_INNER_LABEL(__bhi_args_2, SYM_L_LOCAL) | 
|---|
| 53 | ANNOTATE_NOENDBR | 
|---|
| 54 | UNWIND_HINT_FUNC | 
|---|
| 55 | jne .Lud_1 | 
|---|
| 56 | cmovne %rax, %rdi | 
|---|
| 57 | cmovne %rax, %rsi | 
|---|
| 58 | ANNOTATE_UNRET_SAFE | 
|---|
| 59 | ret | 
|---|
| 60 | int3 | 
|---|
| 61 |  | 
|---|
| 62 | .align 32 | 
|---|
| 63 | SYM_INNER_LABEL(__bhi_args_3, SYM_L_LOCAL) | 
|---|
| 64 | ANNOTATE_NOENDBR | 
|---|
| 65 | UNWIND_HINT_FUNC | 
|---|
| 66 | jne .Lud_1 | 
|---|
| 67 | cmovne %rax, %rdi | 
|---|
| 68 | cmovne %rax, %rsi | 
|---|
| 69 | cmovne %rax, %rdx | 
|---|
| 70 | ANNOTATE_UNRET_SAFE | 
|---|
| 71 | ret | 
|---|
| 72 | int3 | 
|---|
| 73 |  | 
|---|
| 74 | .align 32 | 
|---|
| 75 | SYM_INNER_LABEL(__bhi_args_4, SYM_L_LOCAL) | 
|---|
| 76 | ANNOTATE_NOENDBR | 
|---|
| 77 | UNWIND_HINT_FUNC | 
|---|
| 78 | jne .Lud_2 | 
|---|
| 79 | cmovne %rax, %rdi | 
|---|
| 80 | cmovne %rax, %rsi | 
|---|
| 81 | cmovne %rax, %rdx | 
|---|
| 82 | cmovne %rax, %rcx | 
|---|
| 83 | ANNOTATE_UNRET_SAFE | 
|---|
| 84 | ret | 
|---|
| 85 | int3 | 
|---|
| 86 |  | 
|---|
| 87 | .align 32 | 
|---|
| 88 | SYM_INNER_LABEL(__bhi_args_5, SYM_L_LOCAL) | 
|---|
| 89 | ANNOTATE_NOENDBR | 
|---|
| 90 | UNWIND_HINT_FUNC | 
|---|
| 91 | jne .Lud_2 | 
|---|
| 92 | cmovne %rax, %rdi | 
|---|
| 93 | cmovne %rax, %rsi | 
|---|
| 94 | cmovne %rax, %rdx | 
|---|
| 95 | cmovne %rax, %rcx | 
|---|
| 96 | cmovne %rax, %r8 | 
|---|
| 97 | ANNOTATE_UNRET_SAFE | 
|---|
| 98 | ret | 
|---|
| 99 | int3 | 
|---|
| 100 |  | 
|---|
| 101 | .align 8 | 
|---|
| 102 | ANNOTATE_REACHABLE | 
|---|
| 103 | .Lud_2:	ud2 | 
|---|
| 104 | ANNOTATE_UNRET_SAFE | 
|---|
| 105 | ret | 
|---|
| 106 | int3 | 
|---|
| 107 |  | 
|---|
| 108 | .align 32 | 
|---|
| 109 | SYM_INNER_LABEL(__bhi_args_6, SYM_L_LOCAL) | 
|---|
| 110 | ANNOTATE_NOENDBR | 
|---|
| 111 | UNWIND_HINT_FUNC | 
|---|
| 112 | jne .Lud_2 | 
|---|
| 113 | cmovne %rax, %rdi | 
|---|
| 114 | cmovne %rax, %rsi | 
|---|
| 115 | cmovne %rax, %rdx | 
|---|
| 116 | cmovne %rax, %rcx | 
|---|
| 117 | cmovne %rax, %r8 | 
|---|
| 118 | cmovne %rax, %r9 | 
|---|
| 119 | ANNOTATE_UNRET_SAFE | 
|---|
| 120 | ret | 
|---|
| 121 | int3 | 
|---|
| 122 |  | 
|---|
| 123 | .align 32 | 
|---|
| 124 | SYM_INNER_LABEL(__bhi_args_7, SYM_L_LOCAL) | 
|---|
| 125 | ANNOTATE_NOENDBR | 
|---|
| 126 | UNWIND_HINT_FUNC | 
|---|
| 127 | jne .Lud_2 | 
|---|
| 128 | cmovne %rax, %rdi | 
|---|
| 129 | cmovne %rax, %rsi | 
|---|
| 130 | cmovne %rax, %rdx | 
|---|
| 131 | cmovne %rax, %rcx | 
|---|
| 132 | cmovne %rax, %r8 | 
|---|
| 133 | cmovne %rax, %r9 | 
|---|
| 134 | cmovne %rax, %rsp | 
|---|
| 135 | ANNOTATE_UNRET_SAFE | 
|---|
| 136 | ret | 
|---|
| 137 | int3 | 
|---|
| 138 |  | 
|---|
| 139 | #endif /* CONFIG_FINEIBT_BHI */ | 
|---|
| 140 |  | 
|---|
| 141 | .align 32 | 
|---|
| 142 | SYM_INNER_LABEL(__bhi_args_end, SYM_L_GLOBAL) | 
|---|
| 143 | ANNOTATE_NOENDBR | 
|---|
| 144 | nop /* Work around toolchain+objtool quirk */ | 
|---|
| 145 | SYM_CODE_END(__bhi_args) | 
|---|
| 146 |  | 
|---|
| 147 | .popsection | 
|---|
| 148 |  | 
|---|