Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp448919pxb; Wed, 20 Jan 2021 10:54:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJzi4SqXu1V5DuDLlvvvuDu8T2ANnDqp3h+zArOjkOTDqY8fTQi170JY9is269IFOED2DB0p X-Received: by 2002:a17:906:17c3:: with SMTP id u3mr6745374eje.304.1611168849683; Wed, 20 Jan 2021 10:54:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611168849; cv=none; d=google.com; s=arc-20160816; b=OS8vttYT/vbsu4VRGYmU9LKEKDu6wLVhTyrzTjvNrqBI7aasvp5e/Bg0YG/V0hUwnC 2SmWrYCmewrFZ3Y6Nny2/0I98QsjtSl/rrnC3/sWK9tadTtUjI/IwEhxJOKfbuKbtaFL ltj6dBlojGXWZ2z1Cc/OEJS7sLYlIXKVx9Xlcd3YbOWayjknUSoJhyoO0PJn+Gau+Lyn gLjjQR7ax6u1w3pRZbjkI/Y2QoHZVBAfOO3E/5Hh3oL1zof/cYmX7eYljKyyiCm9jtBG i/GKicrm+p6rgLCbNc/8XRwj/bo7ZKQwJLAAGUZPkY9fOwb++qQUx7T4yBNLacoEx/WE vGAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=9GqcdDd08Zk15EP4JDTkI5z15oNQedvKunbBtce3hNY=; b=ldV4BHcBGcp95Xi4VcMMm60Y29Xwrq4ZVDrRrBgmEDto30Z9ylpajFF+wTvQJFxWiG eFPSdX5uKHXogGTMnCohX97Q0/LgFVx20O5jHh8Qp6vz6HvYU90stUXcPpy+njoDsV+s y/S40PuCYDNIpkndJ/lGTiEBxvzJmbvpd1whE5Ywx3BjKk1yM4xna+T3sfKz2E2hskYb RIMT59Sgt/IWhFRwYJCg2r//4W8WRpupXmGaBd0dzBhLn86m28wzdRQbP6Te2DY2Je6X KrlyX0RjMpa3b3O/KTsVFAmOEB+jnMPijW9cPSQgC+zXbleZAmV2HkJLlJNR7cXqelJY skLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GU1QzZJG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a29si1210550edm.288.2021.01.20.10.53.44; Wed, 20 Jan 2021 10:54:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GU1QzZJG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390047AbhATSv4 (ORCPT + 99 others); Wed, 20 Jan 2021 13:51:56 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:57057 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390219AbhATRkO (ORCPT ); Wed, 20 Jan 2021 12:40:14 -0500 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9GqcdDd08Zk15EP4JDTkI5z15oNQedvKunbBtce3hNY=; b=GU1QzZJG7Y2lDUKVqFXf66U+m/FfdVWpLBTKl0C0OkgxwfHu5nP29VfXcx63IbxkmXyyUJ mqvBh/kBBEwjrxJsWcqVHsktlW4SwXJjRySl3ODfn/6w2HKFYfRV7k8Fy1RA1Dv/tasFTZ va9xSdZFMW502ep3hdJTK0dXoGHtaNc= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-252-Mrr5axjgOVWJig5-lhMcjQ-1; Wed, 20 Jan 2021 12:38:45 -0500 X-MC-Unique: Mrr5axjgOVWJig5-lhMcjQ-1 Received: by mail-wr1-f71.google.com with SMTP id q18so11966841wrc.20 for ; Wed, 20 Jan 2021 09:38:45 -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=QkCNxEBSazIeen/ZBY9P5eKqHYJ3zYM9LEXqH0wf0yQEU/OU1YnW5LvnRsFty3w6YM lWGZOWrWIBgl1aj6aibIr2dLQC06t8j9PNJRQMzTZJZEZURKub2sh5tksos5AGTR1ofG 6MSe7r5FUmbQ7qP7yCDiGzuMD9B1MhEppWBQMAAlrl8HvqcZ3bYb+H2xUyZCa0rQz0e0 wNqOgFPVYTugLtVAJTP6ZvQGF6CdaIeFAJxQsRPdxVZs8UYWN3/D8oZvNbRp7I55KyEj XDOKK2+UxOzXPrfV1ARa5x7B+HdVwUzE0a3wk48ybJuttdAp+CqrKGavLnacnpKwontn JmQQ== X-Gm-Message-State: AOAM530HpmaiEUabuoCIFGBHRIe8oLmlZqOGKR58KvyImBmQpi9MGBln 2nnpx7JHhj+dz2Ixsd21ZTX4BIAot5J2Tbdx9J8BCAYYSWc41/BMB7YoudTGUvhb13NYLPalFfV kUUwE6Owcr3rTCL7jJJ//KQyY2jbxGhImFJfDGX46d7VICAqKcb0cfkfQdbxA8ca1TeSYyINXv+ kk X-Received: by 2002:a1c:6a02:: with SMTP id f2mr5525613wmc.36.1611164324006; Wed, 20 Jan 2021 09:38:44 -0800 (PST) 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 Cc: catalin.marinas@arm.com, will@kernel.org, ardb@kernel.org, masahiroy@kernel.org, keescook@chromium.org, michal.lkml@markovi.net, jpoimboe@redhat.com, peterz@infradead.org, mark.rutland@arm.com, broonie@kernel.org, linux-efi@vger.kernel.org, linux-hardening@vger.kernel.org, Julien Thierry 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 Content-Transfer-Encoding: 8bit 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 --- 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) -- 2.25.4