From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,T_DKIMWL_WL_HIGH, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B646AC072B1 for ; Thu, 30 May 2019 04:06:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8AEC025079 for ; Thu, 30 May 2019 04:06:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559189178; bh=a7LZHAGSnn7a+kd0ARbVNsTrdcYFhfOU/2ik8HLnMxU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=zX5gDfSFMGJR7dyz8OURtgqIUkOicG9t/rNoH2wmqp283ajpkyuaHCOvevjQlyQMF jnefTnlrYN0OrIfA5J7a3QZCLiuOenEuBxefzc15f/uUSCdwAQfH621ARG+MDPL+6v bQzq+dOJeA2kZwQUtEEiShx8bjvANKzmXNQJroSY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726965AbfE3EGR (ORCPT ); Thu, 30 May 2019 00:06:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:47878 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731181AbfE3DRg (ORCPT ); Wed, 29 May 2019 23:17:36 -0400 Received: from localhost (ip67-88-213-2.z213-88-67.customer.algx.net [67.88.213.2]) (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 D2FFD246F4; Thu, 30 May 2019 03:17:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559186255; bh=a7LZHAGSnn7a+kd0ARbVNsTrdcYFhfOU/2ik8HLnMxU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2BJdFEnzgJRByjOK42sZaJegtWTtPhbNWf4uBRVVseK1NRPYOkppWjbOY6g7Dq6/S vegZdZo2VqwHC4TvWh9mMEXMU2pw0d+PuPfnCR7g5pDeB3ClFyS0a4ZbYZFzyhCWU8 XPUfHt91IiNBu/eVUkJVB/jDrxaipMpt4jWBNFjs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kees Cook , Borislav Petkov , "H. Peter Anvin" , Ingo Molnar , Nick Desaulniers , Thomas Gleixner , clang-built-linux@googlegroups.com, x86-ml , Sasha Levin Subject: [PATCH 4.19 184/276] x86/build: Keep local relocations with ld.lld Date: Wed, 29 May 2019 20:05:42 -0700 Message-Id: <20190530030536.752838183@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190530030523.133519668@linuxfoundation.org> References: <20190530030523.133519668@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org [ Upstream commit 7c21383f3429dd70da39c0c7f1efa12377a47ab6 ] The LLVM linker (ld.lld) defaults to removing local relocations, which causes KASLR boot failures. ld.bfd and ld.gold already handle this correctly. This adds the explicit instruction "--discard-none" during the link phase. There is no change in output for ld.bfd and ld.gold, but ld.lld now produces an image with all the needed relocations. Signed-off-by: Kees Cook Signed-off-by: Borislav Petkov Cc: "H. Peter Anvin" Cc: Ingo Molnar Cc: Nick Desaulniers Cc: Thomas Gleixner Cc: clang-built-linux@googlegroups.com Cc: x86-ml Link: https://lkml.kernel.org/r/20190404214027.GA7324@beast Link: https://github.com/ClangBuiltLinux/linux/issues/404 Signed-off-by: Sasha Levin --- arch/x86/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/Makefile b/arch/x86/Makefile index ffc823a8312fb..ab2071e40efe3 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -47,7 +47,7 @@ export REALMODE_CFLAGS export BITS ifdef CONFIG_X86_NEED_RELOCS - LDFLAGS_vmlinux := --emit-relocs + LDFLAGS_vmlinux := --emit-relocs --discard-none endif # -- 2.20.1