Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp4967305iog; Wed, 22 Jun 2022 09:13:10 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uGQi2UNvjC0zqdgN8OBmiNBo3wyjRCLLU298J9P2HINUWuVdHzBfBE6BSIRYkzgzCY8nhM X-Received: by 2002:a17:90b:3b4b:b0:1e8:434c:5ab1 with SMTP id ot11-20020a17090b3b4b00b001e8434c5ab1mr4599112pjb.129.1655914390281; Wed, 22 Jun 2022 09:13:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655914390; cv=none; d=google.com; s=arc-20160816; b=V+xluCmsdzyJiGa117hJzmqexF/EwWWNOWaFHqJE5KCVkwcJ8DumqjxK19LNZO+tSr LtmXCYjd4ES1zg7oU6cTJ8SG0Jh5t44grJctvsnFivRqfTtO/sPQrZ/hCV+fywO3XxY1 0cWUpB9ziKrTJC5OZCI2DCBzWoUyQUU4G1+X9CK/2pt2BlEcc3s2SHXEE/dYktOFzife RWsrgUGeLfR4KSs2SLWckwTgVhmBZ1lhYZW7A4QVbKMGeRET5p91iVPjuF1m+U9WI/K0 qO5Y7yCqWb2DRrGnwA4sJ0c/50RvAF6Zif+e+JQk6Lz+MBvmn8uISA3Aa5rWUI83WkiH 2UFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=zg5gaWyD0Uu9WYjsdSL3Lo2ijL9wVj6sujJXXGR3+Z8=; b=SHlMUOws0gf+G0HlyhQhHsoDuS2DJTzFHsNsHzB3NYVcjhQiYiGC6ytpuIHLJNnIFd wHgEnUGv1DRxazLCWmHJlfUMKJBTKLPco4BRAGnBcumPwVqIY8wYf6fYtGsBJXUPQdkr iEXElXwSpEfPnt8bnVhUHatI3GYnGbywrlOM20L8mg9y9aEgi4CciXeIOesDJsdOeKcR 4vz9tiTJUMbUy+Fx4L5Mz9Was/KNY7ANIcJt6msXvgVPNcml1m+Mah2snvarCEce5ZY5 Og8qNQUD5UXYdOJa4TSt07H0tsbmY/VWWFcdFuK538zU+eb7pgJtobQq2UcM23UZH9ed tSBQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b2-20020a170902d50200b00168fbb6678csi12130595plg.621.2022.06.22.09.12.57; Wed, 22 Jun 2022 09:13:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376260AbiFVP4U (ORCPT + 99 others); Wed, 22 Jun 2022 11:56:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359685AbiFVPxG (ORCPT ); Wed, 22 Jun 2022 11:53:06 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8B3639685; Wed, 22 Jun 2022 08:52:50 -0700 (PDT) Received: from dggpemm500024.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4LSntb4cNMzkWg4; Wed, 22 Jun 2022 23:51:35 +0800 (CST) Received: from dggpemm500013.china.huawei.com (7.185.36.172) by dggpemm500024.china.huawei.com (7.185.36.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 22 Jun 2022 23:52:48 +0800 Received: from ubuntu1804.huawei.com (10.67.175.36) by dggpemm500013.china.huawei.com (7.185.36.172) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 22 Jun 2022 23:52:48 +0800 From: Chen Zhongjin To: , , , , , CC: , , , , , , , , , , , , , Subject: [PATCH v5 33/33] objtool: revert c_file fallthrough detection for arm64 Date: Wed, 22 Jun 2022 23:49:20 +0800 Message-ID: <20220622154920.95075-34-chenzhongjin@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220622154920.95075-1-chenzhongjin@huawei.com> References: <20220622154920.95075-1-chenzhongjin@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.175.36] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500013.china.huawei.com (7.185.36.172) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 'commit 08feafe8d195 ("objtool: Fix function fallthrough detection for vmlinux")' This commit canceled c_file which used to make fallthrough detection only works on C objects. However in arm64/crypto/aes-mods.S, there are cases that JUMP at the end of function which make objtool wrongly detected them as fall through. Revert c_file before this is fixed. Signed-off-by: Chen Zhongjin --- tools/objtool/check.c | 3 +-- tools/objtool/include/objtool/objtool.h | 2 +- tools/objtool/objtool.c | 1 + 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 54b736e94ede..8b8a4ef81d96 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -540,7 +540,6 @@ static struct instruction *find_last_insn(struct objtool_file *file, struct instruction *insn = NULL; unsigned int offset; unsigned int end = (sec->sh.sh_size > 10) ? sec->sh.sh_size - 10 : 0; - for (offset = sec->sh.sh_size - 1; offset >= end && !insn; offset--) insn = find_insn(file, sec, offset); @@ -3219,7 +3218,7 @@ static int validate_branch(struct objtool_file *file, struct symbol *func, while (1) { next_insn = next_insn_to_validate(file, insn); - if (func && insn->func && func != insn->func->pfunc) { + if (file->c_file && func && insn->func && func != insn->func->pfunc) { WARN("%s() falls through to next function %s()", func->name, insn->func->name); return 1; diff --git a/tools/objtool/include/objtool/objtool.h b/tools/objtool/include/objtool/objtool.h index a6e72d916807..7a5c13a78f87 100644 --- a/tools/objtool/include/objtool/objtool.h +++ b/tools/objtool/include/objtool/objtool.h @@ -27,7 +27,7 @@ struct objtool_file { struct list_head static_call_list; struct list_head mcount_loc_list; struct list_head endbr_list; - bool ignore_unreachables, hints, rodata; + bool ignore_unreachables, c_file, hints, rodata; unsigned int nr_endbr; unsigned int nr_endbr_int; diff --git a/tools/objtool/objtool.c b/tools/objtool/objtool.c index 512669ce064c..d33620b1392d 100644 --- a/tools/objtool/objtool.c +++ b/tools/objtool/objtool.c @@ -105,6 +105,7 @@ struct objtool_file *objtool_open_read(const char *_objname) INIT_LIST_HEAD(&file.static_call_list); INIT_LIST_HEAD(&file.mcount_loc_list); INIT_LIST_HEAD(&file.endbr_list); + file.c_file = !opts.link && find_section_by_name(file.elf, ".comment"); file.ignore_unreachables = opts.no_unreachable; file.hints = false; -- 2.17.1