From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C0E4C43217 for ; Tue, 18 Oct 2022 00:15:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231764AbiJRAPV (ORCPT ); Mon, 17 Oct 2022 20:15:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231616AbiJRANa (ORCPT ); Mon, 17 Oct 2022 20:13:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9641E87F94; Mon, 17 Oct 2022 17:09:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EE9EBB81BEF; Tue, 18 Oct 2022 00:09:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA9D1C433B5; Tue, 18 Oct 2022 00:09:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666051794; bh=wb2M51+7H22SevC1ZeGdNgisIHrm626YnHCzZuwH+A4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YCnmLEyuMxeZ5I3tKu5uFZBbk2VgTmylJ6FDxYNWObXa/pBPtIZUf4e2dp5qxur7X Ktb2Bv0uj9KH4ZsIkjfxB8TkwI/4wQvGJU1bi/SlWUymmbRvsfbK4raI7cKGa2+4ZY KZmM8MUGj+o848RuDV72LHzNiaDHwVPkulRd6HOLYqzJtEeSjAmKkXGCfi6iUeh4WD NhE0R249luYpBWwjbBZFKPVEhGsFSDf6q22lUubXy1WweVXvOow9nQighsP6RcdjHp BRCxPYVrlbaSe6jYFa/CBUiqgyWPCxceox4+RiiFFalz6AfhyLpwryda7cHMP8bJz1 l82ZH9lb93Cdg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Peter Zijlstra , Masami Hiramatsu , Sasha Levin , jpoimboe@kernel.org, bp@suse.de, fenghua.yu@intel.com, tony.luck@intel.com Subject: [PATCH AUTOSEL 5.15 07/21] objtool,x86: Teach decode about LOOP* instructions Date: Mon, 17 Oct 2022 20:09:26 -0400 Message-Id: <20221018000940.2731329-7-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221018000940.2731329-1-sashal@kernel.org> References: <20221018000940.2731329-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peter Zijlstra [ Upstream commit 7a7621dfa417aa3715d2a3bd1bdd6cf5018274d0 ] When 'discussing' control flow Masami mentioned the LOOP* instructions and I realized objtool doesn't decode them properly. As it turns out, these instructions are somewhat inefficient and as such unlikely to be emitted by the compiler (a few vmlinux.o checks can't find a single one) so this isn't critical, but still, best to decode them properly. Reported-by: Masami Hiramatsu (Google) Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/Yxhd4EMKyoFoH9y4@hirez.programming.kicks-ass.net Signed-off-by: Sasha Levin --- tools/objtool/arch/x86/decode.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/objtool/arch/x86/decode.c b/tools/objtool/arch/x86/decode.c index f62db0e006e9..16554496af9d 100644 --- a/tools/objtool/arch/x86/decode.c +++ b/tools/objtool/arch/x86/decode.c @@ -574,6 +574,12 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec, *type = INSN_CONTEXT_SWITCH; break; + case 0xe0: /* loopne */ + case 0xe1: /* loope */ + case 0xe2: /* loop */ + *type = INSN_JUMP_CONDITIONAL; + break; + case 0xe8: *type = INSN_CALL; /* -- 2.35.1