Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp5389358iog; Wed, 22 Jun 2022 19:10:13 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sq9I5pzkl0vIEzfY8srCA18/1ul98tfOc0pspTc2jX/cBKABsnSQ6plJtSWkyp7KNUx/9f X-Received: by 2002:a17:90a:e7c8:b0:1e6:961f:999d with SMTP id kb8-20020a17090ae7c800b001e6961f999dmr1451601pjb.23.1655950213052; Wed, 22 Jun 2022 19:10:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655950213; cv=none; d=google.com; s=arc-20160816; b=Zq9Y2qDI7JS5SKkjOTshHhSqDNjWosZN16vDQWAeyjUn2hK9JBEwxxvnkIjVD/CZFj b/X3ooprtnjNTGLwEHJgqitplgrmxFEsm4HLhyLsXvI8zZN94Nk4fAf4r3+BAsOEOdb9 Uzq14BU2JHiY9l5im7LtjmDu92nvvyiGKB3EKkcDV8RzEfKaqZv/o+T2zubtPp7exPWN SrJpuVmgwRGcUPjFpK5x0lTVd074CcH6XrYEM7GV2zxZgkd8eU+l0UOX8NmFlMWXc6ua LZEtGjFRkoGZPqx/M4CVtoiiOVfjFyNFnVG1f6DM4lmAh7N+VE87yOvrbib9aNeqGUtR zm9Q== 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=EBh7SiDnfx3fw1begFvXiJiR3l/V2Oe6cEGiS6W2stg=; b=N5cGSwlTYdq/ssPKYusx9j6k11BgWASFCBvcKiITe6udhCNLQiY2COwRAYhprGUPjM WPq9P83xlneUwTw8pIkqzKAuGiDHkwH9kLPzNJA0IRT7oXXS3upFsdcVBBi/ke1Vdb2G RegAA6bLDSKVbP9SHDmtcOV/J+LtqV6eJj6WziWMcYuWWERunDz9oBqGPYd0HIV+Y2X+ QPNsYIb0OknV253/QafAkN8UsUBclovnRVi7Lk+e1Tc6XnTCgWDun93feTcVfAZFoXUh dJZLz0FeF7wsQVRjed0UJTwdbhZ2btNySuJEKJPIgRV9pN48oEJ2DFNrIx+6H/XRFHoz k8Aw== 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 k184-20020a6384c1000000b0040c9e0a1ef5si16182277pgd.516.2022.06.22.19.10.01; Wed, 22 Jun 2022 19:10:13 -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 S1377535AbiFWByZ (ORCPT + 99 others); Wed, 22 Jun 2022 21:54:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377644AbiFWBwb (ORCPT ); Wed, 22 Jun 2022 21:52:31 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C720343AEA; Wed, 22 Jun 2022 18:51:54 -0700 (PDT) Received: from dggpemm500020.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4LT39q6k6hzkWkG; Thu, 23 Jun 2022 09:50:39 +0800 (CST) Received: from dggpemm500013.china.huawei.com (7.185.36.172) by dggpemm500020.china.huawei.com (7.185.36.49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 23 Jun 2022 09:51:53 +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; Thu, 23 Jun 2022 09:51:52 +0800 From: Chen Zhongjin To: , , , , , CC: , , , , , , , , , , , , , , Subject: [PATCH v6 33/33] objtool: revert c_file fallthrough detection for arm64 Date: Thu, 23 Jun 2022 09:49:17 +0800 Message-ID: <20220623014917.199563-34-chenzhongjin@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220623014917.199563-1-chenzhongjin@huawei.com> References: <20220623014917.199563-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 8ff7c30df513..95cb88da4ed5 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -541,7 +541,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); @@ -3220,7 +3219,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