Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp4976157iog; Wed, 22 Jun 2022 09:23:00 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sCIu2y/ygYDkW5g/Jgf2SImo9ark2YFHf4eYyRb5/JnSNbtTG/z8oHoEzjhnLTesFbDO0H X-Received: by 2002:a63:8849:0:b0:40d:e25:9fb2 with SMTP id l70-20020a638849000000b0040d0e259fb2mr3626394pgd.592.1655914979850; Wed, 22 Jun 2022 09:22:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655914979; cv=none; d=google.com; s=arc-20160816; b=GZR0h3+LPAndBXuLTAIjkfUZ8jL+Iav2vusEV4GAih3JCJsTDXL04ywAwzjiBM8F7h c0tWEyw+JUU5a3bZ698lp8MDBfcTmm1wl8C+taPE0i02cvSjwQECwDPY6kccnpjN1S0T CSQIErbtI5k9KiIhD9jQGHbAD8l3BVHZ7B60+zJHytzR9BSYVegMCVd4jJFa5fOpyAQK SehLFDw3DqRSlLNHjzxi9KFTJTR0zfde4HjcwUsAgOyuiulE7vj4OssCnahrRX/3dHYe qV9XKVY03rBNSHnS2Z79Fbvd1N1HwK2ePR0PR5mw4UqeIZpEIb7mj4x/w5cA4HGybM+E A1Wg== 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=dSRAVXHrthV51Hm6DuVk6FjEHrdTxxMU2WNCRkkaWYE=; b=bDY+S0UjPr3m1j6la3RGKj91qgjL2/78dc7tbfiZQ2S96RamKEL++dob9hlvrkWU68 iE5sd+kkHy9bPsyGd4vXUVzc58Qb4TImvybGapEmrOu6i7tBeiYOcWJky9QPaKdfy4cZ zfLKGWCXyOOY4QR8X3TqLKx3LhAkBuzlTGqyd9GjorjM3qo1M2JCq5IrF3yCUQdXDkCX r6R09fJKtQinnc2ODtS/Mq+g0DUv/uce4FwGpxbh0bkpitGr/KXOttK9GZ3hrkv8w8LG p5zcibZ4YTPI1dPGt6F2KwhB8dstYkrbAiZglnHm/bs6QB/Vihijix/kOAwAtckvvZ3t C1yw== 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 v5-20020a634645000000b0040014af77a9si23507973pgk.783.2022.06.22.09.22.47; Wed, 22 Jun 2022 09:22:59 -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 S1359717AbiFVPzI (ORCPT + 99 others); Wed, 22 Jun 2022 11:55:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359661AbiFVPxC (ORCPT ); Wed, 22 Jun 2022 11:53:02 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F83B2DEE; Wed, 22 Jun 2022 08:52:49 -0700 (PDT) Received: from dggpemm500022.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4LSnvH4T5czDsJm; Wed, 22 Jun 2022 23:52:11 +0800 (CST) Received: from dggpemm500013.china.huawei.com (7.185.36.172) by dggpemm500022.china.huawei.com (7.185.36.162) 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:44 +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:43 +0800 From: Chen Zhongjin To: , , , , , CC: , , , , , , , , , , , , , Subject: [PATCH v5 11/33] objtool: arm64: Ignore replacement section for alternative callback Date: Wed, 22 Jun 2022 23:48:58 +0800 Message-ID: <20220622154920.95075-12-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 ARM64_CB_PATCH doesn't have static replacement instructions. Skip trying to validate the alternative section. Signed-off-by: Julien Thierry Signed-off-by: Chen Zhongjin --- tools/objtool/arch/arm64/special.c | 11 +++++++++++ tools/objtool/check.c | 3 +++ 2 files changed, 14 insertions(+) diff --git a/tools/objtool/arch/arm64/special.c b/tools/objtool/arch/arm64/special.c index a70b91e8bd7d..8bb1ebd2132a 100644 --- a/tools/objtool/arch/arm64/special.c +++ b/tools/objtool/arch/arm64/special.c @@ -4,6 +4,17 @@ void arch_handle_alternative(unsigned short feature, struct special_alt *alt) { + /* + * ARM64_CB_PATCH has no alternative instruction. + * a callback is called at alternative replacement time + * to dynamically change the original instructions. + * + * ARM64_CB_PATCH is the last ARM64 feature, it's value changes + * every time a new feature is added. So the orig/alt region + * length are used to detect those alternatives + */ + if (alt->orig_len && !alt->new_len) + alt->skip_alt = true; } bool arch_support_alt_relocation(struct special_alt *special_alt, diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 77911ca9cfff..54b736e94ede 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -1686,6 +1686,9 @@ static int add_special_section_alts(struct objtool_file *file) continue; } + if (special_alt->skip_alt && !special_alt->new_len) + continue; + ret = handle_group_alt(file, special_alt, orig_insn, &new_insn); if (ret) -- 2.17.1