From patchwork Wed Jan 20 17:37:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Thierry X-Patchwork-Id: 12033103 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43B98C433E0 for ; Wed, 20 Jan 2021 17:48:30 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DAAF9223DB for ; Wed, 20 Jan 2021 17:48:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DAAF9223DB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Vbz2ZtWN2N+DBQmZSrUqBynyyUQ64qMpmieRllIzj84=; b=DZlHo9UHyNRRBSqVXIC61DX5x sNRoi/07fdkqlc0jvaHvUxEzkquldoD5LAHcf4opz9NQg2nsZnHDKp8I5Jj+Vbn4a5aU0xHldiI5h M86/Ff+qoFAbYG26Nza5pdvHDdgtNr8vKbphknCUj00W8fXGZBkKv0Q/F42gHDGRMeninMrPoe2Vt lmJXT1Kv+Sc1CqPY6K61x+dhrM3wZyXl73C9Qom/D0VWxjnKs44dK+lnNsrSZBh/upfeOy+UxBaze RuPKzHorTz2LGAjSPlCBQIvj5mT7cCgPBlb0JwUJCFNKjW9vMQgbHIaMtcc8i4V0lUSzBtX0O3wLM SVGBBx03w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2HYc-00079F-WB; Wed, 20 Jan 2021 17:46:15 +0000 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2HRU-00033T-5R for linux-arm-kernel@lists.infradead.org; Wed, 20 Jan 2021 17:38:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611164327; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9GqcdDd08Zk15EP4JDTkI5z15oNQedvKunbBtce3hNY=; b=iVrm6T3kZK1HKFtxlm32wwYlZoMDVV8bU8cyFweymuUptBSJEWgIo1ZK9c+Hk6wkmahT/n WN6ODefg6V2OXHdLwxvf5PPqFKqS3TYsC+GkT+lVOkgg7vn9+PmNhxWew/WmSJ7zbLwnXM cJyzuCXMfr60Cmxh9IG4VpQ+CVBILDg= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-15-JF3eDnyENvqxKRsnFArHJg-1; Wed, 20 Jan 2021 12:38:45 -0500 X-MC-Unique: JF3eDnyENvqxKRsnFArHJg-1 Received: by mail-wr1-f69.google.com with SMTP id v7so11878883wra.3 for ; Wed, 20 Jan 2021 09:38:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9GqcdDd08Zk15EP4JDTkI5z15oNQedvKunbBtce3hNY=; b=TksMI/VyKBYvlApDRUrHVBdT/8XNMzHpRyx+6lNGOidvWjaTGF2fRqm6KExEDwMb4s gEQ9enpP5F5C+dx0yd78RV8Uf5EoPDFe8wFjplhkF2f0nFMaczV+jPAf0f82YDZK24TK Aa/SH7S5UnwCdYR13bQRr5IquyYKEBK6TTbTkdHWpCHfHuhRPeozqFEEFOtJLqIVHge7 HYLdUGQLHSP5GZc0JqEC+OZ52mjzkFdGvl8VWIy7dQ/aChuplN5UMOtH9Wnm6tfkc3o8 ZePzjxqlGMdIDsLvz1KqYfUUDjG+C4MB3fQUmhcA/DIumDebMVgNarch3yhwFO3YPoNu 5X9Q== X-Gm-Message-State: AOAM5318DSpw0wASpm1tp2hTDiwroqRE0dsLHnnLE/RJrHVwfQxBaBOx aKlBmoQbU2f9V67swzbYhDlygmuhSPTvF3dOTOJ7DpNBkUCB+5LD4lzntVpgqgBrpDEeULdYYOG vsIE8EHhG3kjqrXbQGxOkU2WmSoXJmc6YzM0= X-Received: by 2002:a1c:6a02:: with SMTP id f2mr5525610wmc.36.1611164323971; Wed, 20 Jan 2021 09:38:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJz3m5zpvqhoSgn4NA796inwCeJU9v3FtPD1K/BYY6WVb/FI0tRzJHQ322lTzH3clEsPdXWdpg== X-Received: by 2002:a1c:6a02:: with SMTP id f2mr5525587wmc.36.1611164323845; Wed, 20 Jan 2021 09:38:43 -0800 (PST) Received: from redfedo.redhat.com ([2a01:cb14:499:3d00:cd47:f651:9d80:157a]) by smtp.gmail.com with ESMTPSA id x11sm4948325wmi.4.2021.01.20.09.38.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jan 2021 09:38:43 -0800 (PST) From: Julien Thierry To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH 16/17] objtool: arm64: Ignore replacement section for alternative callback Date: Wed, 20 Jan 2021 18:37:59 +0100 Message-Id: <20210120173800.1660730-17-jthierry@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20210120173800.1660730-1-jthierry@redhat.com> References: <20210120173800.1660730-1-jthierry@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jthierry@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210120_123852_772185_6F19DC8A X-CRM114-Status: GOOD ( 16.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, linux-efi@vger.kernel.org, michal.lkml@markovi.net, keescook@chromium.org, peterz@infradead.org, catalin.marinas@arm.com, masahiroy@kernel.org, broonie@kernel.org, linux-hardening@vger.kernel.org, jpoimboe@redhat.com, will@kernel.org, ardb@kernel.org, Julien Thierry Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org ARM64_CB_PATCH doesn't have static replacement instructions. Skip trying to validate the alternative section. Signed-off-by: Julien Thierry --- tools/objtool/arch/arm64/special.c | 12 ++++++++++++ tools/objtool/check.c | 3 +++ 2 files changed, 15 insertions(+) diff --git a/tools/objtool/arch/arm64/special.c b/tools/objtool/arch/arm64/special.c index d47e5590ed60..aff8577e71e9 100644 --- a/tools/objtool/arch/arm64/special.c +++ b/tools/objtool/arch/arm64/special.c @@ -24,6 +24,18 @@ struct switch_table_info { void arch_handle_alternative(unsigned short feature, struct special_alt *alt) { + if (alt->orig_len && !alt->new_len) { + /* + * 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 + */ + 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 d902697a388e..8840af09f843 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -1182,6 +1182,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)