From patchwork Fri Oct 23 14:48:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 55493 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by patches.linaro.org (Postfix) with ESMTPS id 98CC022A9D for ; Fri, 23 Oct 2015 14:49:55 +0000 (UTC) Received: by wicfg8 with SMTP id fg8sf12628875wic.0 for ; Fri, 23 Oct 2015 07:49:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:cc:mime-version:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list; bh=keLchdEAxW15bgKpudUBSy5xrMqe3FJ4+Np1jhtUOW4=; b=Xh1rUe1rrN7jPCI98ozcXkT8JDI2DrLXTmFzuGs0a7IgdpArEt+RysUHY29mCXNAL4 BRgzcjrEcHNybIwQvLuC8rvNmDI6bLw/b7II060tklTXBK6J7N+HPdL3M85odXbhETCp K7aUUmCZHApmjn7d76tNEcW4eStqPM1uRyyJm3WUeONiJBNk0ODvnwUnc4M166az8Ec4 FHLtlhbJhWHyN4QrSnGY8JbsifLK1qwx1dli4zexaj86ZOEMYRLCIf/Zx6WuB/ODXwrX ozwri8dN63QaAPprvMP++VoHV+DpXWa8XUl/BQW9GHCkc2haal/tiRXWq552rNiZL5qk CBeQ== X-Gm-Message-State: ALoCoQkkKAbXrPd9HlHnpOdwdzOYrwbJFua4nx4pbVcAHFoC3qLBoUC8dI5N2HWF0Z23dcojXHLs X-Received: by 10.112.147.7 with SMTP id tg7mr5061102lbb.16.1445611794854; Fri, 23 Oct 2015 07:49:54 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.31.8 with SMTP id f8ls194990lff.31.gmail; Fri, 23 Oct 2015 07:49:54 -0700 (PDT) X-Received: by 10.112.72.201 with SMTP id f9mr11613312lbv.62.1445611794720; Fri, 23 Oct 2015 07:49:54 -0700 (PDT) Received: from mail-lf0-x22c.google.com (mail-lf0-x22c.google.com. [2a00:1450:4010:c07::22c]) by mx.google.com with ESMTPS id yn5si12875775lbb.1.2015.10.23.07.49.54 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Oct 2015 07:49:54 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c07::22c as permitted sender) client-ip=2a00:1450:4010:c07::22c; Received: by lffv3 with SMTP id v3so86230164lff.0 for ; Fri, 23 Oct 2015 07:49:54 -0700 (PDT) X-Received: by 10.112.139.201 with SMTP id ra9mr11494730lbb.29.1445611794553; Fri, 23 Oct 2015 07:49:54 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1287366lbq; Fri, 23 Oct 2015 07:49:53 -0700 (PDT) X-Received: by 10.69.26.7 with SMTP id iu7mr5613038pbd.27.1445611793460; Fri, 23 Oct 2015 07:49:53 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id cz3si30041341pbb.218.2015.10.23.07.49.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Oct 2015 07:49:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZpdeE-0000K3-Vq; Fri, 23 Oct 2015 14:48:50 +0000 Received: from mail-pa0-x22a.google.com ([2607:f8b0:400e:c03::22a]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZpdeA-0000Dq-Q4 for linux-arm-kernel@lists.infradead.org; Fri, 23 Oct 2015 14:48:48 +0000 Received: by padhk11 with SMTP id hk11so120496831pad.1 for ; Fri, 23 Oct 2015 07:48:25 -0700 (PDT) X-Received: by 10.68.221.230 with SMTP id qh6mr5512087pbc.20.1445611705782; Fri, 23 Oct 2015 07:48:25 -0700 (PDT) Received: from jessie.localdomain ([103.232.89.42]) by smtp.gmail.com with ESMTPSA id ff2sm8852542pac.14.2015.10.23.07.48.23 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 23 Oct 2015 07:48:25 -0700 (PDT) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, leif.lindholm@linaro.org, matt@codeblueprint.co.uk, linux-efi@vger.kernel.org, jeremy.linton@arm.com, mark.rutland@arm.com, Suzuki.Poulose@arm.com Subject: [PATCH] arm64/efi: move arm64 specific stub C code to libstub Date: Fri, 23 Oct 2015 16:48:14 +0200 Message-Id: <1445611694-31838-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.1.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151023_074846_956559_3121559F X-CRM114-Status: GOOD ( 12.70 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2607:f8b0:400e:c03:0:0:0:22a listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Cc: ryabinin.a.a@gmail.com, Ard Biesheuvel MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Original-Sender: ard.biesheuvel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c07::22c as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=neutral (body hash did not verify) header.i=@linaro_org.20150623.gappssmtp.com Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Now that we added special handling to the C files in libstub, move the one remaining arm64 specific EFI stub C file to libstub as well, so that it gets the same treatment. This should prevent future changes from resulting in binaries that may execute incorrectly in UEFI context. With efi-entry.S the only remaining EFI stub source file under arch/arm64, we can also simplify the Makefile logic somewhat. Signed-off-by: Ard Biesheuvel --- I would like to suggest that this be taken on top of the stuff that is queued for 4.4 at the moment (if it is not too late already). arch/arm64/kernel/Makefile | 9 ++------- drivers/firmware/efi/libstub/Makefile | 3 +++ arch/arm64/kernel/efi-stub.c => drivers/firmware/efi/libstub/arm64-stub.c | 0 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/arch/arm64/kernel/efi-stub.c b/drivers/firmware/efi/libstub/arm64-stub.c similarity index 100% rename from arch/arm64/kernel/efi-stub.c rename to drivers/firmware/efi/libstub/arm64-stub.c diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile index 1b6bda2ff102..474691f8b13a 100644 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile @@ -4,11 +4,8 @@ CPPFLAGS_vmlinux.lds := -DTEXT_OFFSET=$(TEXT_OFFSET) AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET) -CFLAGS_efi-stub.o := -DTEXT_OFFSET=$(TEXT_OFFSET) CFLAGS_armv8_deprecated.o := -I$(src) -KASAN_SANITIZE_efi-stub.o := n - CFLAGS_REMOVE_ftrace.o = -pg CFLAGS_REMOVE_insn.o = -pg CFLAGS_REMOVE_return_address.o = -pg @@ -22,9 +19,7 @@ arm64-obj-y := debug-monitors.o entry.o irq.o fpsimd.o \ cpufeature.o alternative.o cacheinfo.o \ smp.o smp_spin_table.o topology.o -stub-obj := efi-stub.o efi-entry.o -extra-y := $(stub-obj) -stub-obj := $(patsubst %.o,%.stub.o,$(stub-obj)) +extra-$(CONFIG_EFI) := efi-entry.o OBJCOPYFLAGS := --prefix-symbols=__efistub_ $(obj)/%.stub.o: $(obj)/%.o FORCE @@ -42,7 +37,7 @@ arm64-obj-$(CONFIG_CPU_PM) += sleep.o suspend.o arm64-obj-$(CONFIG_CPU_IDLE) += cpuidle.o arm64-obj-$(CONFIG_JUMP_LABEL) += jump_label.o arm64-obj-$(CONFIG_KGDB) += kgdb.o -arm64-obj-$(CONFIG_EFI) += efi.o $(stub-obj) +arm64-obj-$(CONFIG_EFI) += efi.o efi-entry.stub.o arm64-obj-$(CONFIG_PCI) += pci.o arm64-obj-$(CONFIG_ARMV8_DEPRECATED) += armv8_deprecated.o arm64-obj-$(CONFIG_ACPI) += acpi.o diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile index bca9a76cbd33..92ae557abbbc 100644 --- a/drivers/firmware/efi/libstub/Makefile +++ b/drivers/firmware/efi/libstub/Makefile @@ -34,6 +34,9 @@ $(obj)/lib-%.o: $(srctree)/lib/%.c FORCE lib-$(CONFIG_EFI_ARMSTUB) += arm-stub.o fdt.o string.o \ $(patsubst %.c,lib-%.o,$(arm-deps)) +lib-$(CONFIG_ARM64) += arm64-stub.o +CFLAGS_arm64-stub.o := -DTEXT_OFFSET=$(TEXT_OFFSET) + # # arm64 puts the stub in the kernel proper, which will unnecessarily retain all # code indefinitely unless it is annotated as __init/__initdata/__initconst etc.