Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5606718imu; Mon, 26 Nov 2018 02:55:38 -0800 (PST) X-Google-Smtp-Source: AFSGD/UoFnO1Q+gU+NPw675Eaysz1jex0FYyThGChBH/JhAVhJw4TcQN8kYSSKc/2eH4KAIb4Mos X-Received: by 2002:a63:da45:: with SMTP id l5mr24664220pgj.111.1543229737955; Mon, 26 Nov 2018 02:55:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543229737; cv=none; d=google.com; s=arc-20160816; b=PwHG3yvC+wqa6VoMBF4ii5lFwFzxerYWVFtj9G9zy15J48PKp7/VadZ5S6CuBRxAPG MbWlyNBI4TBLagEHHpZO+0SkAbcvk6sknqXSUWa9O8wVMiiFHkOUFEwk+O8Hbtg7HkZ/ fmTlidvA+1QcBNBZcBXQCQTex1KbDglKX2lc+ve9EK+ARfPg1FuAcd+2ruAgcnBI1sMx bVdzeH6S3NqEFPgBQGG6AAue5wPKxIzVHZeEUy64UTIRIREZ6DijvqBw92ndWIFrTyff nCgsqKaEtxwen9tfNKOS+8ADeFl22GcOMWS3s3ZzK1RObz0yK+4+FqFGhLhGJVfzzePS acmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3VVxm0KBI27pj2sbltIAiE8POZOkcnya5gmJok4Ps0Y=; b=tH+d0GnEm11OedZarbVe33nSOLHi6XSdP6YTt4x5nHqEMIn9hiTD37+RI5wcZBcfpM dzIPj51cCYX3U+ZqYDUX36cU1pheZs2Q81vNNQjXTpeCtlLIoBUxFMessq/5z2yrBP9q Xxnzr9/1GF+7L184sP67MRi00MH6GzybKGDaK8T6w5YEFLVDYUxzX7Ux+B4frXaVNImE lYLWkHDKhy/0XLSg2BORRLByUNQUkVxY5poRh4El9bxi1Tf4sF6dZ0uGR5CTve0ZoU5f 3UjV4A349uCBZtmzfZBqavPAChM4gsawab7a6BR7x3MbjwaDZ+CAJMV8DixYOEEAkwfR t5ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cedkTM96; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y11si40398935pgj.442.2018.11.26.02.55.22; Mon, 26 Nov 2018 02:55:37 -0800 (PST) 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=cedkTM96; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727276AbeKZVrx (ORCPT + 99 others); Mon, 26 Nov 2018 16:47:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:56184 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726254AbeKZVrw (ORCPT ); Mon, 26 Nov 2018 16:47:52 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C4DB82146F; Mon, 26 Nov 2018 10:54:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543229648; bh=Um1uA36yTrZrtv/CfrAye/+lLictZ2usYz08AVOv+2I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cedkTM96jGrGThL7cq/oDnGv5qQ7/MF5GZtyUObuXtVD+TesnZAhhRXcNaG+U1Mtq +fsfUlHg9iR01HqsJ6En/E5NlsUNt19ZNgB/Pw7vlZ6K0WJrwLfgp8aIYgb2EOBIcc sVBhv2zA2pOZR06dwR8q00ElCkzwp9n2ZMnFZEkg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matthias Kaehlcke , Ard Biesheuvel , Linus Torvalds , Matt Fleming , Peter Zijlstra , Thomas Gleixner , linux-efi@vger.kernel.org, Ingo Molnar , Nathan Chancellor Subject: [PATCH 4.4 19/70] efi/libstub/arm64: Set -fpie when building the EFI stub Date: Mon, 26 Nov 2018 11:50:34 +0100 Message-Id: <20181126105048.681817537@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181126105046.722096341@linuxfoundation.org> References: <20181126105046.722096341@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ard Biesheuvel commit 91ee5b21ee026c49e4e7483de69b55b8b47042be upstream. Clang may emit absolute symbol references when building in non-PIC mode, even when using the default 'small' code model, which is already mostly position independent to begin with, due to its use of adrp/add pairs that have a relative range of +/- 4 GB. The remedy is to pass the -fpie flag, which can be done safely now that the code has been updated to avoid GOT indirections (which may be emitted due to the compiler assuming that the PIC/PIE code may end up in a shared library that is subject to ELF symbol preemption) Passing -fpie when building code that needs to execute at an a priori unknown offset is arguably an improvement in any case, and given that the recent visibility changes allow the PIC build to pass with GCC as well, let's add -fpie for all arm64 builds rather than only for Clang. Tested-by: Matthias Kaehlcke Signed-off-by: Ard Biesheuvel Cc: Linus Torvalds Cc: Matt Fleming Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: linux-efi@vger.kernel.org Link: http://lkml.kernel.org/r/20170818194947.19347-5-ard.biesheuvel@linaro.org Signed-off-by: Ingo Molnar Signed-off-by: Nathan Chancellor Signed-off-by: Greg Kroah-Hartman --- drivers/firmware/efi/libstub/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/firmware/efi/libstub/Makefile +++ b/drivers/firmware/efi/libstub/Makefile @@ -10,7 +10,7 @@ cflags-$(CONFIG_X86) += -m$(BITS) -D__K -fPIC -fno-strict-aliasing -mno-red-zone \ -mno-mmx -mno-sse -DDISABLE_BRANCH_PROFILING -cflags-$(CONFIG_ARM64) := $(subst -pg,,$(KBUILD_CFLAGS)) +cflags-$(CONFIG_ARM64) := $(subst -pg,,$(KBUILD_CFLAGS)) -fpie cflags-$(CONFIG_ARM) := $(subst -pg,,$(KBUILD_CFLAGS)) \ -fno-builtin -fpic -mno-single-pic-base