|
63 | 63 | "911:\n\t" \
|
64 | 64 | __ASM_ANNOTATE(911b, type)
|
65 | 65 |
|
66 |
| -#define ANNOTATE_NOENDBR ASM_ANNOTATE(ANNOTYPE_NOENDBR) |
67 |
| - |
68 | 66 | #else /* __ASSEMBLY__ */
|
69 | 67 |
|
70 | 68 | /*
|
|
113 | 111 | #endif
|
114 | 112 | .endm
|
115 | 113 |
|
116 |
| -/* |
117 |
| - * Use objtool to validate the entry requirement that all code paths do |
118 |
| - * VALIDATE_UNRET_END before RET. |
119 |
| - * |
120 |
| - * NOTE: The macro must be used at the beginning of a global symbol, otherwise |
121 |
| - * it will be ignored. |
122 |
| - */ |
123 |
| -#if defined(CONFIG_NOINSTR_VALIDATION) && \ |
124 |
| - (defined(CONFIG_MITIGATION_UNRET_ENTRY) || defined(CONFIG_MITIGATION_SRSO)) |
125 |
| -#define VALIDATE_UNRET_BEGIN ANNOTATE type=ANNOTYPE_UNRET_BEGIN |
126 |
| -#else |
127 |
| -#define VALIDATE_UNRET_BEGIN |
128 |
| -#endif |
129 | 114 |
|
130 | 115 | .macro REACHABLE
|
131 | 116 | .Lhere_\@:
|
|
142 | 127 | .popsection
|
143 | 128 | .endm
|
144 | 129 |
|
145 |
| -#define ANNOTATE_NOENDBR ANNOTATE type=ANNOTYPE_NOENDBR |
146 |
| - |
147 |
| -/* |
148 |
| - * This macro indicates that the following intra-function call is valid. |
149 |
| - * Any non-annotated intra-function call will cause objtool to issue a warning. |
150 |
| - */ |
151 |
| -#define ANNOTATE_INTRA_FUNCTION_CALL ANNOTATE type=ANNOTYPE_INTRA_FUNCTION_CALL |
152 |
| - |
153 | 130 | #endif /* __ASSEMBLY__ */
|
154 | 131 |
|
155 | 132 | #else /* !CONFIG_OBJTOOL */
|
|
161 | 138 | #define STACK_FRAME_NON_STANDARD_FP(func)
|
162 | 139 | #define __ASM_ANNOTATE(label, type)
|
163 | 140 | #define ASM_ANNOTATE(type)
|
164 |
| -#define ANNOTATE_NOENDBR |
165 | 141 | #define ASM_REACHABLE
|
166 | 142 | #else
|
167 |
| -#define ANNOTATE_INTRA_FUNCTION_CALL |
168 | 143 | .macro UNWIND_HINT type:req sp_reg=0 sp_offset=0 signal=0
|
169 | 144 | .endm
|
170 | 145 | .macro STACK_FRAME_NON_STANDARD func:req
|
171 | 146 | .endm
|
172 |
| -.macro ANNOTATE_NOENDBR |
173 |
| -.endm |
174 | 147 | .macro REACHABLE
|
175 | 148 | .endm
|
176 | 149 | .macro ANNOTATE type:req
|
|
179 | 152 |
|
180 | 153 | #endif /* CONFIG_OBJTOOL */
|
181 | 154 |
|
| 155 | +#ifndef __ASSEMBLY__ |
| 156 | +/* |
| 157 | + * Annotate away the various 'relocation to !ENDBR` complaints; knowing that |
| 158 | + * these relocations will never be used for indirect calls. |
| 159 | + */ |
| 160 | +#define ANNOTATE_NOENDBR ASM_ANNOTATE(ANNOTYPE_NOENDBR) |
| 161 | +/* |
| 162 | + * This should be used immediately before an indirect jump/call. It tells |
| 163 | + * objtool the subsequent indirect jump/call is vouched safe for retpoline |
| 164 | + * builds. |
| 165 | + */ |
| 166 | +#define ANNOTATE_RETPOLINE_SAFE ASM_ANNOTATE(ANNOTYPE_RETPOLINE_SAFE) |
| 167 | +/* |
| 168 | + * See linux/instrumentation.h |
| 169 | + */ |
| 170 | +#define ANNOTATE_INSTR_BEGIN(label) __ASM_ANNOTATE(label, ANNOTYPE_INSTR_BEGIN) |
| 171 | +#define ANNOTATE_INSTR_END(label) __ASM_ANNOTATE(label, ANNOTYPE_INSTR_END) |
| 172 | +/* |
| 173 | + * objtool annotation to ignore the alternatives and only consider the original |
| 174 | + * instruction(s). |
| 175 | + */ |
| 176 | +#define ANNOTATE_IGNORE_ALTERNATIVE ASM_ANNOTATE(ANNOTYPE_IGNORE_ALTS) |
| 177 | +/* |
| 178 | + * This macro indicates that the following intra-function call is valid. |
| 179 | + * Any non-annotated intra-function call will cause objtool to issue a warning. |
| 180 | + */ |
| 181 | +#define ANNOTATE_INTRA_FUNCTION_CALL ASM_ANNOTATE(ANNOTYPE_INTRA_FUNCTION_CALL) |
| 182 | +/* |
| 183 | + * Use objtool to validate the entry requirement that all code paths do |
| 184 | + * VALIDATE_UNRET_END before RET. |
| 185 | + * |
| 186 | + * NOTE: The macro must be used at the beginning of a global symbol, otherwise |
| 187 | + * it will be ignored. |
| 188 | + */ |
| 189 | +#define ANNOTATE_UNRET_BEGIN ASM_ANNOTATE(ANNOTYPE_UNRET_BEGIN) |
| 190 | + |
| 191 | +#else |
| 192 | +#define ANNOTATE_NOENDBR ANNOTATE type=ANNOTYPE_NOENDBR |
| 193 | +#define ANNOTATE_RETPOLINE_SAFE ANNOTATE type=ANNOTYPE_RETPOLINE_SAFE |
| 194 | +/* ANNOTATE_INSTR_BEGIN ANNOTATE type=ANNOTYPE_INSTR_BEGIN */ |
| 195 | +/* ANNOTATE_INSTR_END ANNOTATE type=ANNOTYPE_INSTR_END */ |
| 196 | +#define ANNOTATE_IGNORE_ALTERNATIVE ANNOTATE type=ANNOTYPE_IGNORE_ALTS |
| 197 | +#define ANNOTATE_INTRA_FUNCTION_CALL ANNOTATE type=ANNOTYPE_INTRA_FUNCTION_CALL |
| 198 | +#define ANNOTATE_UNRET_BEGIN ANNOTATE type=ANNOTYPE_UNRET_BEGIN |
| 199 | +#endif |
| 200 | + |
| 201 | +#if defined(CONFIG_NOINSTR_VALIDATION) && \ |
| 202 | + (defined(CONFIG_MITIGATION_UNRET_ENTRY) || defined(CONFIG_MITIGATION_SRSO)) |
| 203 | +#define VALIDATE_UNRET_BEGIN ANNOTATE_UNRET_BEGIN |
| 204 | +#else |
| 205 | +#define VALIDATE_UNRET_BEGIN |
| 206 | +#endif |
| 207 | + |
182 | 208 | #endif /* _LINUX_OBJTOOL_H */
|
0 commit comments