Re: [PATCH] objtool: fix another gcc jump table detection issue

From: Arnd Bergmann
Date: Thu Mar 02 2017 - 18:02:42 EST


On Thu, Mar 2, 2017 at 11:57 PM, Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:
>
> Arnd Bergmann reported a (false positive) objtool warning:
>
> drivers/infiniband/sw/rxe/rxe_resp.o: warning: objtool: rxe_responder()+0xfe: sibling call from callable instruction with changed frame pointer
>
> The issue is in find_switch_table(). It tries to find a switch
> statement's jump table by walking backwards from an indirect jump
> instruction, looking for a relocation to the .rodata section. In this
> case it stopped walking prematurely: the first .rodata relocation it
> encountered was for a variable (resp_state_name) instead of a jump
> table, so it just assumed there wasn't a jump table.
>
> The fix is to ignore any .rodata relocation which refers to an ELF
> object symbol. This works because the jump tables are anonymous and
> have no symbols associated with them.
>
> Reported-by: Arnd Bergmann <arnd@xxxxxxxx>
> Fixes: 3732710ff6f2 ("objtool: Improve rare switch jump table pattern detection")
> Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>

Tested-by: Arnd Bergmann <arnd@xxxxxxxx>