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 49E22C433FE for ; Tue, 18 Oct 2022 00:16:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231897AbiJRAP6 (ORCPT ); Mon, 17 Oct 2022 20:15:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231770AbiJRAOS (ORCPT ); Mon, 17 Oct 2022 20:14:18 -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 6B51E1C917; Mon, 17 Oct 2022 17:10:59 -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 3B34EB81BFD; Tue, 18 Oct 2022 00:10:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 139D5C433D7; Tue, 18 Oct 2022 00:10:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666051844; bh=c3LtuAuodLdDaX0+owhIwb/958mbG6hmwe/kQzCDBHI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ChGML8uCW0AP+3V8l2fbHeB3jC/Q9O3oxnTUF2Kk9wBw2lO9oWpQ4y8JLSiHVYoCP SDCqiaLp6jxCx7i4vCpWyMIvaRahcim/oVvBZWhWrfPCL4mR+YNhyUWM/OxxKlGpGM WYbv93Hkeal1hBkGfbPyPkLFJfUt+zVApsj978cS9SNpYm3I4kGCatn+6Z9snfJAaz qR9dC9Az3qc6RJhGYKSimlpKnTvguiuohBT9wJ5A2IMU41eRe37BJVokE33ec7su9c I+kskpY04irtoSxns+l2ZZzmHvzZ+xDygLfnAwoEFpzFDfZAVRbtewBxi3nphTjIqk 0xI/5BwQ4+Dsg== 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.10 07/16] objtool,x86: Teach decode about LOOP* instructions Date: Mon, 17 Oct 2022 20:10:20 -0400 Message-Id: <20221018001029.2731620-7-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221018001029.2731620-1-sashal@kernel.org> References: <20221018001029.2731620-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 d8f47704fd85..c804b0b4215b 100644 --- a/tools/objtool/arch/x86/decode.c +++ b/tools/objtool/arch/x86/decode.c @@ -501,6 +501,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