From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754020AbeAKX2y (ORCPT + 1 other); Thu, 11 Jan 2018 18:28:54 -0500 Received: from terminus.zytor.com ([65.50.211.136]:41527 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932148AbeAKX2w (ORCPT ); Thu, 11 Jan 2018 18:28:52 -0500 Date: Thu, 11 Jan 2018 15:22:27 -0800 From: tip-bot for Josh Poimboeuf Message-ID: Cc: ak@linux.intel.com, jpoimboe@redhat.com, dave.hansen@intel.com, pjt@google.com, torvalds@linux-foundation.org, luto@amacapital.net, jikos@kernel.org, tim.c.chen@linux.intel.com, dwmw@amazon.co.uk, keescook@google.com, linux-kernel@vger.kernel.org, tglx@linutronix.de, riel@redhat.com, mingo@kernel.org, hpa@zytor.com, gregkh@linux-foundation.org, peterz@infradead.org Reply-To: tglx@linutronix.de, linux-kernel@vger.kernel.org, keescook@google.com, riel@redhat.com, mingo@kernel.org, hpa@zytor.com, gregkh@linux-foundation.org, peterz@infradead.org, dave.hansen@intel.com, ak@linux.intel.com, jpoimboe@redhat.com, pjt@google.com, torvalds@linux-foundation.org, luto@amacapital.net, jikos@kernel.org, tim.c.chen@linux.intel.com, dwmw@amazon.co.uk In-Reply-To: <1515707194-20531-2-git-send-email-dwmw@amazon.co.uk> References: <1515707194-20531-2-git-send-email-dwmw@amazon.co.uk> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/pti] objtool: Detect jumps to retpoline thunks Git-Commit-ID: 39b735332cb8b33a27c28592d969e4016c86c3ea X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: Commit-ID: 39b735332cb8b33a27c28592d969e4016c86c3ea Gitweb: https://git.kernel.org/tip/39b735332cb8b33a27c28592d969e4016c86c3ea Author: Josh Poimboeuf AuthorDate: Thu, 11 Jan 2018 21:46:23 +0000 Committer: Thomas Gleixner CommitDate: Fri, 12 Jan 2018 00:14:28 +0100 objtool: Detect jumps to retpoline thunks A direct jump to a retpoline thunk is really an indirect jump in disguise. Change the objtool instruction type accordingly. Objtool needs to know where indirect branches are so it can detect switch statement jump tables. This fixes a bunch of warnings with CONFIG_RETPOLINE like: arch/x86/events/intel/uncore_nhmex.o: warning: objtool: nhmex_rbox_msr_enable_event()+0x44: sibling call from callable instruction with modified stack frame kernel/signal.o: warning: objtool: copy_siginfo_to_user()+0x91: sibling call from callable instruction with modified stack frame ... Signed-off-by: Josh Poimboeuf Signed-off-by: David Woodhouse Signed-off-by: Thomas Gleixner Cc: gnomes@lxorguk.ukuu.org.uk Cc: Rik van Riel Cc: Andi Kleen Cc: thomas.lendacky@amd.com Cc: Peter Zijlstra Cc: Linus Torvalds Cc: Jiri Kosina Cc: Andy Lutomirski Cc: Dave Hansen Cc: Kees Cook Cc: Tim Chen Cc: Greg Kroah-Hartman Cc: Paul Turner Link: https://lkml.kernel.org/r/1515707194-20531-2-git-send-email-dwmw@amazon.co.uk --- tools/objtool/check.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 9b341584..de053fb 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -456,6 +456,13 @@ static int add_jump_destinations(struct objtool_file *file) } else if (rela->sym->sec->idx) { dest_sec = rela->sym->sec; dest_off = rela->sym->sym.st_value + rela->addend + 4; + } else if (strstr(rela->sym->name, "_indirect_thunk_")) { + /* + * Retpoline jumps are really dynamic jumps in + * disguise, so convert them accordingly. + */ + insn->type = INSN_JUMP_DYNAMIC; + continue; } else { /* sibling call */ insn->jump_dest = 0;