diff options
author | Josh Poimboeuf <jpoimboe@redhat.com> | 2021-01-21 22:29:18 +0100 |
---|---|---|
committer | Josh Poimboeuf <jpoimboe@redhat.com> | 2021-01-26 18:11:59 +0100 |
commit | 1f9a1b74942485a0a29e7c4a9a9f2fe8aea17766 (patch) | |
tree | fed5d10db74d928885cbac6c194893a21ca34556 /tools/objtool/check.c | |
parent | objtool: Fix error handling for STD/CLD warnings (diff) | |
download | linux-1f9a1b74942485a0a29e7c4a9a9f2fe8aea17766.tar.xz linux-1f9a1b74942485a0a29e7c4a9a9f2fe8aea17766.zip |
objtool: Fix retpoline detection in asm code
The JMP_NOSPEC macro branches to __x86_retpoline_*() rather than the
__x86_indirect_thunk_*() wrappers used by C code. Detect jumps to
__x86_retpoline_*() as retpoline dynamic jumps.
Presumably this doesn't trigger a user-visible bug. I only found it
when testing vmlinux.o validation.
Fixes: 39b735332cb8 ("objtool: Detect jumps to retpoline thunks")
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Link: https://lore.kernel.org/r/31f5833e2e4f01e3d755889ac77e3661e906c09f.1611263461.git.jpoimboe@redhat.com
Diffstat (limited to 'tools/objtool/check.c')
-rw-r--r-- | tools/objtool/check.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 3bdd946c2027..081572170f6b 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -785,7 +785,8 @@ static int add_jump_destinations(struct objtool_file *file) dest_sec = reloc->sym->sec; dest_off = reloc->sym->sym.st_value + arch_dest_reloc_offset(reloc->addend); - } else if (strstr(reloc->sym->name, "_indirect_thunk_")) { + } else if (!strncmp(reloc->sym->name, "__x86_indirect_thunk_", 21) || + !strncmp(reloc->sym->name, "__x86_retpoline_", 16)) { /* * Retpoline jumps are really dynamic jumps in * disguise, so convert them accordingly. |