diff options
| author | Peter Zijlstra <peterz@infradead.org> | 2025-02-07 13:15:35 +0100 |
|---|---|---|
| committer | Peter Zijlstra <peterz@infradead.org> | 2025-02-14 10:32:06 +0100 |
| commit | ab9fea59487d8b5149a323e2092b7c0f53994dd5 (patch) | |
| tree | af2a4894157549c4aa3355fe79496b16c7f17634 /tools/objtool/check.c | |
| parent | x86/boot: Mark start_secondary() with __noendbr (diff) | |
| download | linux-ab9fea59487d8b5149a323e2092b7c0f53994dd5.tar.gz linux-ab9fea59487d8b5149a323e2092b7c0f53994dd5.zip | |
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.org
Diffstat (limited to 'tools/objtool/check.c')
| -rw-r--r-- | tools/objtool/check.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 753dbc4f8198..26f2c1b8e099 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -1283,15 +1283,6 @@ static void annotate_call_site(struct objtool_file *file, if (!sym) sym = reloc->sym; - /* - * Alternative replacement code is just template code which is - * sometimes copied to the original instruction. For now, don't - * annotate it. (In the future we might consider annotating the - * original instruction if/when it ever makes sense to do so.) - */ - if (!strcmp(insn->sec->name, ".altinstr_replacement")) - return; - if (sym->static_call_tramp) { list_add_tail(&insn->call_node, &file->static_call_list); return; @@ -1349,7 +1340,8 @@ static void annotate_call_site(struct objtool_file *file, return; } - if (insn->type == INSN_CALL && !insn->sec->init) + if (insn->type == INSN_CALL && !insn->sec->init && + !insn->_call_dest->embedded_insn) list_add_tail(&insn->call_node, &file->call_list); if (!sibling && dead_end_function(file, sym)) |
