From patchwork Wed Mar 3 17:09:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Thierry X-Patchwork-Id: 12114597 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.8 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 746ADC433E0 for ; Wed, 3 Mar 2021 23:59:38 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 7845F64F4B for ; Wed, 3 Mar 2021 23:59:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7845F64F4B 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=fHkv4Z4pn1Emgp6KDV61/Ty272UNdWowik/zL/C62NI=; b=Mni0MXnqU4ypu2PHn1e9rEUBC WGOGm4b9NBRoDKNDWQbUrg05CS/r0Ry48i2Pzr/XZW2V2ptwtgb0n+aJrniD7hxzLKz/9AK0s457V YfqyoxEVd0MajXjvZTwtLqYWGsC1fQk1kFlUIyeRIoz7Y58vDjFtZ3aMCcqQNqs5GVshcvAb9X1/l 2uA5F4SRbHaPYsl77B9RhbXXJE6XIZ2z7jYKvb/705iXf9vp9wwTjgaa/d8mPW0ORju2P52rue2lk OgaQ+aSiEZ54GFtbqJb8cKqajL3lRsiB0guTzArdwPorPNPj0OTQwFyPuLnWaU58akGheDX4iaTxc 7Kt05KF/A==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lHbL7-0072h6-Nz; Wed, 03 Mar 2021 23:55:39 +0000 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lHV0Z-005juH-Gg for linux-arm-kernel@lists.infradead.org; Wed, 03 Mar 2021 17:10:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614791398; 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=A5pHfgks8bE8qlKvv/oEckSFicNRsQyVV+w+PZ4/ahE=; b=huMpHaFsNLc1ghkBJlRQa8UVSuKWEGeNJIcZL6f4QHfHqhrCv2jtjTjLh6dwQt4IQRTOkD MDzomCDUm4clyNLhhCTB79TaxLS6AduwsaXh0+M5Xdvjw37KlGZAeACP4nZgsLiMX97+aX IhQU0eRWEXXWzRhwJuBTCwGqvFThW2A= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-576-IrwZKu-WMbCMnxs2mc6gow-1; Wed, 03 Mar 2021 12:09:56 -0500 X-MC-Unique: IrwZKu-WMbCMnxs2mc6gow-1 Received: by mail-wm1-f69.google.com with SMTP id r21so2065163wmq.7 for ; Wed, 03 Mar 2021 09:09:56 -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=A5pHfgks8bE8qlKvv/oEckSFicNRsQyVV+w+PZ4/ahE=; b=W4FVl5jb/sQl+7ssJMT1ED2d4NWWVPuEAFKo3FZylF/2i/ffEZ31fjDcUOAY1UIcvY vNrYAmHnpVaLThUBhC448r4+Z9GmGUlxqefFED+ryZeEBUZMUsr4DoK9qHOAmT1IpYm2 vcyS4dPXMmyNITn3qbwatgcZOAHkpWz4KoeYE0YCuQu2XE3Hw477Qg/cWUsZeNUYkH59 IC2kFIZ1fpL9sa19ZNvAZLM6yzX87xqQNEfActJiYWOfaMG8qEL89F+mTyvI8d4OY03h Hqx+DcTdIrNYgB6Iomo1ELap3ww0e1AYES92EjNZMgXIpEK1Q5WjlOViMIx4wqKd798w +cEw== X-Gm-Message-State: AOAM5338Xlr39hv67gYlxNpsd+ynh9YSf5EpGddYteVAd1c42baIAyDI 4AwoAjSmta4mdlZ9bexNGrWljItE5lhWLwu2dM5KDQmYsLlUxPavjE0Ko1NAk89oH8+lGmDEV/h KgS9a9kBVO3W1USThzfMoc/AaS3aOnSUXsKs= X-Received: by 2002:a1c:61c5:: with SMTP id v188mr60130wmb.20.1614791395353; Wed, 03 Mar 2021 09:09:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJxAMudXXtDkJMo6R18P9LAM27S/BaFG0DloKr5DpvCDqGgJlTHuTm3VI8TM8m6dVxwzx+MgOw== X-Received: by 2002:a1c:61c5:: with SMTP id v188mr60113wmb.20.1614791395166; Wed, 03 Mar 2021 09:09:55 -0800 (PST) Received: from redfedo.redhat.com ([2a01:cb14:499:3d00:cd47:f651:9d80:157a]) by smtp.gmail.com with ESMTPSA id r7sm33066226wre.25.2021.03.03.09.09.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Mar 2021 09:09:54 -0800 (PST) From: Julien Thierry To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com, ardb@kernel.org, masahiroy@kernel.org, jpoimboe@redhat.com, peterz@infradead.org, ycote@redhat.com, Julien Thierry Subject: [RFC PATCH v2 12/13] objtool: arm64: Ignore replacement section for alternative callback Date: Wed, 3 Mar 2021 18:09:31 +0100 Message-Id: <20210303170932.1838634-13-jthierry@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20210303170932.1838634-1-jthierry@redhat.com> References: <20210303170932.1838634-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-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 a70b91e8bd7d..ed642bd6f886 100644 --- a/tools/objtool/arch/arm64/special.c +++ b/tools/objtool/arch/arm64/special.c @@ -4,6 +4,18 @@ 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 7750f6342855..1999d1f1967a 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -1293,6 +1293,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)