]> git.baikalelectronics.ru Git - kernel.git/commit
objtool: Only rewrite unconditional retpoline thunk calls
authorPeter Zijlstra <peterz@infradead.org>
Thu, 10 Jun 2021 07:04:29 +0000 (09:04 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Fri, 11 Jun 2021 06:53:06 +0000 (08:53 +0200)
commit9bc4bfc6ab6540363b45edbcb60d597c03fb7d90
treeab75c8cfd9dafa5f54af3988bcb7c595380e307c
parent1205cbf5e3d80b45320183f5d049680a66fad569
objtool: Only rewrite unconditional retpoline thunk calls

It turns out that the compilers generate conditional branches to the
retpoline thunks like:

  5d5:   0f 85 00 00 00 00       jne    5db <cpuidle_reflect+0x22>
5d7: R_X86_64_PLT32     __x86_indirect_thunk_r11-0x4

while the rewrite can only handle JMP/CALL to the thunks. The result
is the alternative wrecking the code. Make sure to skip writing the
alternatives for conditional branches.

Fixes: db8e6c9e5e72 ("objtool/x86: Rewrite retpoline thunk calls")
Reported-by: Lukasz Majczak <lma@semihalf.com>
Reported-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Nathan Chancellor <nathan@kernel.org>
tools/objtool/arch/x86/decode.c