From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754883AbcJZPeL (ORCPT ); Wed, 26 Oct 2016 11:34:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48528 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754581AbcJZPeJ (ORCPT ); Wed, 26 Oct 2016 11:34:09 -0400 Date: Wed, 26 Oct 2016 10:34:08 -0500 From: Josh Poimboeuf To: Arnd Bergmann Cc: Ingo Molnar , linux-kernel@vger.kernel.org Subject: [PATCH] objtool: fix rare switch jump table pattern detection Message-ID: <20161026153408.2rifnw7bvoc5sex7@treble> References: <3971280.DNU2zoGODW@wuerfel> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <3971280.DNU2zoGODW@wuerfel> User-Agent: Mutt/1.6.0.1 (2016-04-01) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 26 Oct 2016 15:34:09 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit: 3732710ff6f2 ("objtool: Improve rare switch jump table pattern detection") ... improved objtool's ability to detect gcc switch statement jump tables for gcc 6. However the check to allow short jumps with the scanned range of instructions wasn't quite right. The pattern detection should allow jumps to the indirect jump instruction itself. This fixes the following warning: drivers/infiniband/sw/rxe/rxe_comp.o: warning: objtool: rxe_completer()+0x315: sibling call from callable instruction with changed frame pointer Reported-by: Arnd Bergmann Fixes: 3732710ff6f2 ("objtool: Improve rare switch jump table pattern detection") Signed-off-by: Josh Poimboeuf --- tools/objtool/builtin-check.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c index 4490601..e8a1f69 100644 --- a/tools/objtool/builtin-check.c +++ b/tools/objtool/builtin-check.c @@ -754,7 +754,7 @@ static struct rela *find_switch_table(struct objtool_file *file, if (insn->type == INSN_JUMP_UNCONDITIONAL && insn->jump_dest && (insn->jump_dest->offset <= insn->offset || - insn->jump_dest->offset >= orig_insn->offset)) + insn->jump_dest->offset > orig_insn->offset)) break; text_rela = find_rela_by_dest_range(insn->sec, insn->offset, -- 2.7.4