Commit 87c87ec
Peter Zijlstra
bpf,x86: Respect X86_FEATURE_RETPOLINE*
Current BPF codegen doesn't respect X86_FEATURE_RETPOLINE* flags and
unconditionally emits a thunk call, this is sub-optimal and doesn't
match the regular, compiler generated, code.
Update the i386 JIT to emit code equal to what the compiler emits for
the regular kernel text (IOW. a plain THUNK call).
Update the x86_64 JIT to emit code similar to the result of compiler
and kernel rewrites as according to X86_FEATURE_RETPOLINE* flags.
Inlining RETPOLINE_AMD (lfence; jmp *%reg) and !RETPOLINE (jmp *%reg),
while doing a THUNK call for RETPOLINE.
This removes the hard-coded retpoline thunks and shrinks the generated
code. Leaving a single retpoline thunk definition in the kernel.
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Reviewed-by: Borislav Petkov <[email protected]>
Acked-by: Alexei Starovoitov <[email protected]>
Acked-by: Josh Poimboeuf <[email protected]>
Tested-by: Alexei Starovoitov <[email protected]>
Link: https://lore.kernel.org/r/[email protected]1 parent dceba08 commit 87c87ec
File tree
3 files changed
+41
-86
lines changed- arch/x86
- include/asm
- net
3 files changed
+41
-86
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
316 | 316 | | |
317 | 317 | | |
318 | 318 | | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
377 | | - | |
378 | 319 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
387 | 387 | | |
388 | 388 | | |
389 | 389 | | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
390 | 409 | | |
391 | 410 | | |
392 | 411 | | |
| |||
468 | 487 | | |
469 | 488 | | |
470 | 489 | | |
471 | | - | |
| 490 | + | |
472 | 491 | | |
473 | 492 | | |
474 | 493 | | |
| |||
1179 | 1198 | | |
1180 | 1199 | | |
1181 | 1200 | | |
1182 | | - | |
1183 | | - | |
| 1201 | + | |
1184 | 1202 | | |
1185 | 1203 | | |
1186 | 1204 | | |
| |||
2084 | 2102 | | |
2085 | 2103 | | |
2086 | 2104 | | |
2087 | | - | |
2088 | | - | |
2089 | | - | |
2090 | | - | |
2091 | | - | |
2092 | | - | |
2093 | | - | |
2094 | | - | |
2095 | | - | |
2096 | | - | |
2097 | | - | |
2098 | | - | |
2099 | | - | |
2100 | | - | |
2101 | | - | |
2102 | | - | |
2103 | | - | |
2104 | | - | |
2105 | 2105 | | |
2106 | 2106 | | |
2107 | 2107 | | |
| |||
2123 | 2123 | | |
2124 | 2124 | | |
2125 | 2125 | | |
2126 | | - | |
2127 | | - | |
2128 | | - | |
| 2126 | + | |
2129 | 2127 | | |
2130 | 2128 | | |
2131 | 2129 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
1267 | 1268 | | |
1268 | 1269 | | |
1269 | 1270 | | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
1270 | 1286 | | |
1271 | 1287 | | |
1272 | 1288 | | |
| |||
1280 | 1296 | | |
1281 | 1297 | | |
1282 | 1298 | | |
1283 | | - | |
| 1299 | + | |
1284 | 1300 | | |
1285 | 1301 | | |
1286 | 1302 | | |
| |||
1362 | 1378 | | |
1363 | 1379 | | |
1364 | 1380 | | |
1365 | | - | |
| 1381 | + | |
1366 | 1382 | | |
1367 | 1383 | | |
1368 | 1384 | | |
| |||
2122 | 2138 | | |
2123 | 2139 | | |
2124 | 2140 | | |
2125 | | - | |
| 2141 | + | |
2126 | 2142 | | |
2127 | 2143 | | |
2128 | 2144 | | |
| |||
0 commit comments