Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1631282ybb; Thu, 9 Apr 2020 06:09:04 -0700 (PDT) X-Google-Smtp-Source: APiQypKS4Om+fjPHx31xcagHDmQrXsxNiIg4P+xKm4aQ27+n691YVAcFSVZ8M5fNRVXFjlep56I/ X-Received: by 2002:aed:2341:: with SMTP id i1mr4394710qtc.34.1586437744580; Thu, 09 Apr 2020 06:09:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586437744; cv=none; d=google.com; s=arc-20160816; b=LSmV7hRSUF6WcEAQ28t7bkd/alEd+xjSgmm4UlYLiE7ASZ23wkyfE/HRB43jD1ds5M gRyqoHbp6D+CjDY7I7oEqG0XKeXGv+PtwswQravernCt/zBUXX1895gHZfKnvwF8ykPx 2ViSb5FeaBwwb+QPkWuu0hNuMWeZNUr6Au41nPx27QjcwPJfgn5UUbH0H9wr028IjEnS TPi7vw5RUCYYhgCQuWihUk5a16C/4X5av6JtFnA9B+3+BfEMcfb3UeRSWtZksPePiLKQ c6xuH4AG4ZmbBThn8rHWXeooHKBHL5U2ZMQWkjkrSE4zRYZvYP859jiWTMOzYuFQSYQF kxmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=UwS19xu8PLlL1AepCi0w0ch7L0zlLZKRWAJa9j/X7io=; b=MQfsHAxPmc5kVGjf672m/i5BR9nTY5Uw+cvLVrVL7Ujoat5TaJzLV8xsx7nXKsElgs VPIKJE5Tke6z4FEZhTgFxFfMUt4jItvNm/d+NuBGWFCHVENTRMriWgTeUyZ47PmB4Msg HcNh0i3GcOVo79svkmY+6LCsYrXf9gCRlCAMgbRmn6eGY54Qr54emzkJYCu0H5u0uz03 bvtseiV7eGTXnG315KgWHDHioEOoJJ2iM2HkbKAlVqZW/2Uaa43i0vj4doE+mcE0EKCo zHvgeiQ5zjTnPGSUZN4GCUioeqxZQ+CzvPmriuwTQ+XO4F2pISBeWhZs2KPzjmN6R8qL GFeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1FVLQHqZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cx12si5330794qvb.37.2020.04.09.06.08.41; Thu, 09 Apr 2020 06:09:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1FVLQHqZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726875AbgDINFM (ORCPT + 99 others); Thu, 9 Apr 2020 09:05:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:43976 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726690AbgDINFJ (ORCPT ); Thu, 9 Apr 2020 09:05:09 -0400 Received: from e123331-lin.home (amontpellier-657-1-18-247.w109-210.abo.wanadoo.fr [109.210.65.247]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A468D214DB; Thu, 9 Apr 2020 13:05:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586437509; bh=j2Uul8LoJ+xuLlVQplR6zRGNuoR46qZQgWKeGWtCP9M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1FVLQHqZZ3dJFJ/Dp0qXgAM9u3DO6P8HY2BB8qSBahAVovsuk4F52Kvugkw8PW9p3 rWlneg+YMLuxJXM6M7fMy++9jzWeKXrYcnnyk+rFmbe0thDzOQ2PpuhkdSQC09GZwQ LzuZsKXGkmQiuH3SDzkZE5b7r9a4DyrICFPT+5E8= From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner Cc: Ard Biesheuvel , linux-kernel@vger.kernel.org, Arnd Bergmann , Arvind Sankar , Borislav Petkov , Colin Ian King , Gary Lin , Jiri Slaby , Sergey Shatunov , Takashi Iwai Subject: [PATCH 5/9] efi/arm: Deal with ADR going out of range in efi_enter_kernel() Date: Thu, 9 Apr 2020 15:04:30 +0200 Message-Id: <20200409130434.6736-6-ardb@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200409130434.6736-1-ardb@kernel.org> References: <20200409130434.6736-1-ardb@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 0698fac4ac2a ("efi/arm: Clean EFI stub exit code from cache instead of avoiding it") introduced a PC-relative reference to 'call_cache_fn' into efi_enter_kernel(), which lives way at the end of head.S. In some cases, the ARM version of the ADR instruction does not have sufficient range, resulting in a build error: arch/arm/boot/compressed/head.S:1453: Error: invalid constant (fffffffffffffbe4) after fixup ARM defines an alternative with a wider range, called ADRL, but this does not exist for Thumb-2. At the same time, the ADR instruction in Thumb-2 has a wider range, and so it does not suffer from the same issue. So let's switch to ADRL for ARM builds, and keep the ADR for Thumb-2 builds. Reported-by: Arnd Bergmann Tested-by: Arnd Bergmann Signed-off-by: Ard Biesheuvel --- arch/arm/boot/compressed/head.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S index 04f77214f050..61e6ee3ba75f 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S @@ -1454,7 +1454,8 @@ ENTRY(efi_enter_kernel) @ running beyond the PoU, and so calling cache_off below from @ inside the PE/COFF loader allocated region is unsafe unless @ we explicitly clean it to the PoC. - adr r0, call_cache_fn @ region of code we will + ARM( adrl r0, call_cache_fn ) + THUMB( adr r0, call_cache_fn ) @ region of code we will adr r1, 0f @ run with MMU off bl cache_clean_flush bl cache_off -- 2.17.1