Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp5379577iog; Wed, 22 Jun 2022 18:56:10 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vzC3mBjFNryWrAJqWMfPAeZnC4L3zP3u/CHXnUMPtTcT6DUExuN1O3mWY1gp1QX+9zTCLG X-Received: by 2002:a05:6402:1c09:b0:435:6562:e70d with SMTP id ck9-20020a0564021c0900b004356562e70dmr7541465edb.203.1655949370372; Wed, 22 Jun 2022 18:56:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655949370; cv=none; d=google.com; s=arc-20160816; b=dLK04N+JAPkbz2tEcZXDxcbOZw5gAbY6KjCM6BZX248SuDvGeZuyAy7de9dbRXmmfu LsJEpygXE1QTUHQaFzle1BQOWqKCOggYVAVrWJpg8r36vmqjCUANo88ywHMlibjxLL9S P/KEOjIGlNvRWa3dtZIx52e4uOk1MfrLgu0YCi9fAORo0WnEgUgos8QLeEe4xMjgo41k BVkTQI9M+VNaKINhK1ch7FdDBs4c1eOsC674Dan6vu+58sKBJbSjVpiceSdJ/wTc3xQf wYh6uEGD19Dm9qRnlQAl42DdADsISBeOFkr17xtAMMGC7/HK9BXySCkY3lRh1mJEWTdH chlA== 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=xSYAyZjOTTi11s2DBik9czxZJwJI6p8m9hoBjxumG4c=; b=IUm3Xx7gi9y1bhjx8MO5VY5oDdZDNv2JxQA/lLydQRi7I++IQ9kJl7WkZ+KXWTo1MV sxf4PE1NapG/qslVbV8emGtTqFhH16KMvwn2a15YpAmjFvn0V2TCT95+wM0tBSI84jIm 8A1ZfLa9jRcv5uOpcQ75KCnv7gaoGdjUCVBtFBpqxtsRBj96BxGl/vZ1mtfDuZdEeI/o zJJ4y5kGis+B3KJhkoUZuvtB6Rb288toXR69FCufXdnVCNVfKZoUAslzebp597yfYSW4 ZFhZS99y/nQgYvT5Qr6IMQm0yZm+uxRlQXLXPEz5IH7HyHXsRja3IjpGe2aMoke5oN4i X4HQ== 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 sd27-20020a1709076e1b00b006fef771604csi22239875ejc.497.2022.06.22.18.55.44; Wed, 22 Jun 2022 18:56: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 S1377796AbiFWBwn (ORCPT + 99 others); Wed, 22 Jun 2022 21:52:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357371AbiFWBvv (ORCPT ); Wed, 22 Jun 2022 21:51:51 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1EA543AE5; Wed, 22 Jun 2022 18:51:49 -0700 (PDT) Received: from dggpemm500023.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4LT39k6GtCzkWhV; Thu, 23 Jun 2022 09:50:34 +0800 (CST) Received: from dggpemm500013.china.huawei.com (7.185.36.172) by dggpemm500023.china.huawei.com (7.185.36.83) 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: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; Thu, 23 Jun 2022 09:51:47 +0800 From: Chen Zhongjin To: , , , , , CC: , , , , , , , , , , , , , , Subject: [PATCH v6 11/33] objtool: arm64: Ignore replacement section for alternative callback Date: Thu, 23 Jun 2022 09:48:55 +0800 Message-ID: <20220623014917.199563-12-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 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 f19ea3fc1e6b..8ff7c30df513 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -1687,6 +1687,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