diff options
author | 2023-02-08 18:10:52 +0100 | |
---|---|---|
committer | 2023-05-10 14:47:08 +0200 | |
commit | 270a69c4485d7d07516d058bcc0473c90ee22185 (patch) | |
tree | b8f40326a00e414cc5a4cc7d7f768072bc669e38 /tools/objtool/arch | |
parent | x86/alternative: Make debug-alternative selective (diff) | |
download | linux-270a69c4485d7d07516d058bcc0473c90ee22185.tar.gz linux-270a69c4485d7d07516d058bcc0473c90ee22185.tar.bz2 linux-270a69c4485d7d07516d058bcc0473c90ee22185.zip |
x86/alternative: Support relocations in alternatives
A little while ago someone (Kirill) ran into the whole 'alternatives don't
do relocations nonsense' again and I got annoyed enough to actually look
at the code.
Since the whole alternative machinery already fully decodes the
instructions it is simple enough to adjust immediates and displacement
when needed. Specifically, the immediates for IP modifying instructions
(JMP, CALL, Jcc) and the displacement for RIP-relative instructions.
[ bp: Massage comment some more and get rid of third loop in
apply_relocation(). ]
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20230208171431.313857925@infradead.org
Diffstat (limited to 'tools/objtool/arch')
-rw-r--r-- | tools/objtool/arch/x86/special.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/tools/objtool/arch/x86/special.c b/tools/objtool/arch/x86/special.c index 7c97b7391279..799ad6bb72e5 100644 --- a/tools/objtool/arch/x86/special.c +++ b/tools/objtool/arch/x86/special.c @@ -42,13 +42,7 @@ bool arch_support_alt_relocation(struct special_alt *special_alt, struct instruction *insn, struct reloc *reloc) { - /* - * The x86 alternatives code adjusts the offsets only when it - * encounters a branch instruction at the very beginning of the - * replacement group. - */ - return insn->offset == special_alt->new_off && - (insn->type == INSN_CALL || is_jump(insn)); + return true; } /* |