From patchwork Wed May 12 14:42:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 435622 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp5077873jao; Wed, 12 May 2021 11:29:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNmAcB9Meb2frKZRfotxFiqQ+ylBOvXmK0mcBZDxZDLzzQVZ19NKO/34NO5ruWBAhxh5bS X-Received: by 2002:a92:d250:: with SMTP id v16mr32327655ilg.248.1620844178846; Wed, 12 May 2021 11:29:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620844178; cv=none; d=google.com; s=arc-20160816; b=swN9ifsH00zy8E7C3ixAzEzwC2IKfAGBczWlPrSW/+H5Wevyjj9RcISMZ50RtzMqmJ fg7F1lSiHAPYx3P26mtW2pMLB/JXnRqjiGqj7Iz2+aNJiJqVxtBOVb1y8Km3XqF/Ytlm SszMzwlpkK+7FfFnrHfVjxeqWHjyMBHqaJDN88j3l0q0lNgVRxjMQjrxvM3YzJW/mdkW HIRkBhKu78EDVQ3IgLU/HwRuFMDwLfr/97NDJJcI8qhBR8hVUUD5FQWsPs2ojs8uvWZN KJzK0u+cbn7Fdsyga1wZUvvXE3Dtqxs/S0x0U3zJ5ilHEhmEUvL/8MXDOPpBSEj4cGGu ZoMg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pmdAFfPnrzqI59tjQ+1RHKYzr2zDzHeVGNTEIoAty1U=; b=zfbNqm5NT2F8v0EPbcG57ihMfIpoxzHEeQnfxnvTNl2wgKWSRLOXZb7H4lvkdHFU46 Rdq1VyJuDbdlSjTLpFKVWiiAqj0AoXvYehBzbg57kwhYxbUCywhK0ofTmbr1Hb397EWg 9EOC1mk7ZpChNVbameLiTUgyyhiMQeC8p0VxLi80uy7PvZTwCFtJrj8yZdWqTzsn76Ye EmJRIXgJpI8Z8fhgj2d+0/IH7N9tzOmuvHLMc15mS7JI+rGy9NrjhTPbQR3GDAxchgwl LLkPuuuVvTewVuJNIpkGFXSJ76HudNyTXQ4VUvJMrpQJ8rSZRGR1aygdXYuu81iEtif5 dvAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="B7//ftRR"; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q8si330223ior.12.2021.05.12.11.29.38; Wed, 12 May 2021 11:29:38 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-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=@linuxfoundation.org header.s=korg header.b="B7//ftRR"; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242594AbhELQfL (ORCPT + 12 others); Wed, 12 May 2021 12:35:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:44832 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241657AbhELQ1q (ORCPT ); Wed, 12 May 2021 12:27:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AF6B561DFA; Wed, 12 May 2021 15:54:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620834890; bh=WGJM24H87IV1cFTUbbAlOeYWk9NY0ci639uGr9WFkKc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B7//ftRRpzL2Ws+mm7y9GzSnpr+XJXdyhDV9aASjurhBA0E6hGqLlfvCSobmV/ibE JxACJZCRUAKTBzcB4XxhPUGzPJJHE3OXMfEx9tzSudGkXWXnzpmHonoAMFzRM904dP Ff8gxBtf2fqRp+MweL1p9UXKjkUrDVizyMSNZsj8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Will Deacon , David Brazdil , Marc Zyngier Subject: [PATCH 5.12 125/677] KVM: arm64: Support PREL/PLT relocs in EL2 code Date: Wed, 12 May 2021 16:42:51 +0200 Message-Id: <20210512144841.367275440@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144837.204217980@linuxfoundation.org> References: <20210512144837.204217980@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: David Brazdil commit 77e06b300161d41d65950be9c77a785c142b381d upstream. gen-hyprel tool parses object files of the EL2 portion of KVM and generates runtime relocation data. While only filtering for R_AARCH64_ABS64 relocations in the input object files, it has an allow-list of relocation types that are used for relative addressing. Other, unexpected, relocation types are rejected and cause the build to fail. This allow-list did not include the position-relative relocation types R_AARCH64_PREL64/32/16 and the recently introduced _PLT32. While not seen used by toolchains in the wild, add them to the allow-list for completeness. Fixes: 8c49b5d43d4c ("KVM: arm64: Generate hyp relocation data") Cc: Reported-by: Will Deacon Signed-off-by: David Brazdil Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20210331133048.63311-1-dbrazdil@google.com Signed-off-by: Greg Kroah-Hartman --- arch/arm64/kvm/hyp/nvhe/gen-hyprel.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) --- a/arch/arm64/kvm/hyp/nvhe/gen-hyprel.c +++ b/arch/arm64/kvm/hyp/nvhe/gen-hyprel.c @@ -50,6 +50,18 @@ #ifndef R_AARCH64_ABS64 #define R_AARCH64_ABS64 257 #endif +#ifndef R_AARCH64_PREL64 +#define R_AARCH64_PREL64 260 +#endif +#ifndef R_AARCH64_PREL32 +#define R_AARCH64_PREL32 261 +#endif +#ifndef R_AARCH64_PREL16 +#define R_AARCH64_PREL16 262 +#endif +#ifndef R_AARCH64_PLT32 +#define R_AARCH64_PLT32 314 +#endif #ifndef R_AARCH64_LD_PREL_LO19 #define R_AARCH64_LD_PREL_LO19 273 #endif @@ -371,6 +383,12 @@ static void emit_rela_section(Elf64_Shdr case R_AARCH64_ABS64: emit_rela_abs64(rela, sh_orig_name); break; + /* Allow position-relative data relocations. */ + case R_AARCH64_PREL64: + case R_AARCH64_PREL32: + case R_AARCH64_PREL16: + case R_AARCH64_PLT32: + break; /* Allow relocations to generate PC-relative addressing. */ case R_AARCH64_LD_PREL_LO19: case R_AARCH64_ADR_PREL_LO21: