Re: [PATCH v6 22/25] x86/asm: annotate indirect jumps

From: Josh Poimboeuf
Date: Wed Oct 21 2020 - 14:30:36 EST


On Wed, Oct 21, 2020 at 11:51:33AM +0200, Peter Zijlstra wrote:
> On Tue, Oct 20, 2020 at 01:52:17PM -0500, Josh Poimboeuf wrote:
> > > arch/x86/lib/retpoline.S:
> > > __x86_retpoline_rdi()+0x10: return with modified stack frame
> > > __x86_retpoline_rdi()+0x0: stack state mismatch: cfa1=7+32 cfa2=7+8
> > > __x86_retpoline_rdi()+0x0: stack state mismatch: cfa1=7+32 cfa2=-1+0
> >
> > Is this with upstream? I thought we fixed that with
> > UNWIND_HINT_RET_OFFSET.
>
> I can't reproduce this one either; but I do get different warnings:
>
> gcc (Debian 10.2.0-13) 10.2.0, x86_64-defconfig:
>
> defconfig-build/vmlinux.o: warning: objtool: __x86_indirect_thunk_rax() falls through to next function __x86_retpoline_rax()
> defconfig-build/vmlinux.o: warning: objtool: .altinstr_replacement+0x1063: (branch)
> defconfig-build/vmlinux.o: warning: objtool: __x86_indirect_thunk_rax()+0x0: (alt)
> defconfig-build/vmlinux.o: warning: objtool: __x86_indirect_thunk_rax()+0x0: <=== (sym)
>
> (for every single register, not just rax)
>
> Which is daft as well, because the retpoline.o run is clean. It also
> doesn't make sense because __x86_retpoline_rax isn't in fact STT_FUNC,
> so WTH ?!

It is STT_FUNC:

SYM_FUNC_START_NOALIGN(__x86_retpoline_\reg)

$ readelf -s vmlinux.o |grep __x86_retpoline_rax
129749: 0000000000000005 17 FUNC GLOBAL DEFAULT 39 __x86_retpoline_rax

--
Josh