Commit ab9fea5
Peter Zijlstra
x86/alternative: Simplify callthunk patching
Now that paravirt call patching is implemented using alternatives, it
is possible to avoid having to patch the alternative sites by
including the altinstr_replacement calls in the call_sites list.
This means we're now stacking relative adjustments like so:
callthunks_patch_builtin_calls():
patches all function calls to target: func() -> func()-10
since the CALL accounting lives in the CALL_PADDING.
This explicitly includes .altinstr_replacement
alt_replace_call():
patches: x86_BUG() -> target()
this patching is done in a relative manner, and will preserve
the above adjustment, meaning that with calldepth patching it
will do: x86_BUG()-10 -> target()-10
apply_relocation():
does code relocation, and adjusts all RIP-relative instructions
to the new location, also in a relative manner.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
Link: https://lore.kernel.org/r/20250207122546.617187089@infradead.org1 parent 93f16a1 commit ab9fea5
File tree
6 files changed
+13
-39
lines changed- arch/x86
- include/asm
- kernel
- tools/objtool
- arch/x86
6 files changed
+13
-39
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
104 | 103 | | |
105 | 104 | | |
106 | 105 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1705 | 1705 | | |
1706 | 1706 | | |
1707 | 1707 | | |
1708 | | - | |
1709 | | - | |
1710 | 1708 | | |
1711 | | - | |
1712 | | - | |
| 1709 | + | |
| 1710 | + | |
1713 | 1711 | | |
1714 | 1712 | | |
1715 | 1713 | | |
| 1714 | + | |
| 1715 | + | |
1716 | 1716 | | |
1717 | 1717 | | |
1718 | 1718 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | 242 | | |
253 | 243 | | |
254 | 244 | | |
255 | 245 | | |
256 | 246 | | |
257 | | - | |
258 | 247 | | |
259 | 248 | | |
260 | 249 | | |
| |||
263 | 252 | | |
264 | 253 | | |
265 | 254 | | |
266 | | - | |
267 | | - | |
268 | 255 | | |
269 | 256 | | |
270 | 257 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
| 278 | + | |
284 | 279 | | |
285 | 280 | | |
286 | 281 | | |
287 | 282 | | |
288 | 283 | | |
289 | 284 | | |
290 | 285 | | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | 286 | | |
297 | 287 | | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
298 | 293 | | |
299 | 294 | | |
300 | 295 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
850 | 850 | | |
851 | 851 | | |
852 | 852 | | |
| 853 | + | |
853 | 854 | | |
854 | 855 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1283 | 1283 | | |
1284 | 1284 | | |
1285 | 1285 | | |
1286 | | - | |
1287 | | - | |
1288 | | - | |
1289 | | - | |
1290 | | - | |
1291 | | - | |
1292 | | - | |
1293 | | - | |
1294 | | - | |
1295 | 1286 | | |
1296 | 1287 | | |
1297 | 1288 | | |
| |||
1349 | 1340 | | |
1350 | 1341 | | |
1351 | 1342 | | |
1352 | | - | |
| 1343 | + | |
| 1344 | + | |
1353 | 1345 | | |
1354 | 1346 | | |
1355 | 1347 | | |
| |||
0 commit comments