Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp252542ybi; Wed, 29 May 2019 20:41:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqzVIZ/u+fz93rtm5ZfZjySMOWgl6236CJyFW2Z/1uifrS1+gxjYEHsMtS+h11DJRuJy4Ck3 X-Received: by 2002:a62:164f:: with SMTP id 76mr1573677pfw.172.1559187714708; Wed, 29 May 2019 20:41:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559187714; cv=none; d=google.com; s=arc-20160816; b=YFnb4HU5YLWCqP1q/zv8pMNBYqAfIziR5d+DLjIFEwrDC/5wumd/wcZO1qKrP6h8El Op2iPbsEVXhAY1Zwk5/Zpne1KUfEwPdllt7/i2EyS4xCYAthve2UnjKqIRR/yeXRggsx JdVb6li+s3ur3Xl7Jq3d3/8PtMTSMsaQn5RWgg5+L+X63u1vTtwLhMfulpkSu1fWyFhO QlVYV/VHiDBL1QPlTZ7NnU2m972N0lRKBk0IBk6guGIl4rJ+wVWZGNI10V9S+55+XFFX t6v6SuMM6N9tTuJ93Ey+I2bzCWOb3Bxj/63qOtEM/voSe0hc7oQJQkDX3ZyLbFb3HVvs wH/Q== 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=sxwONJLAogy1Fx1iWLA1d7M55GEU5s6FPuXzLutBYZI=; b=xpSrIsvUxA6QzPq1hKBlfvwuLMcLqvffAfjQMc0palcqbanQb/vjW2+jDQ1wrkiGXQ juydZE2u7IMe8GpvQTRXqq5COwNjL+KVVdeAjgX8Xyr0quVbtgTeD55EW/XST7/O8tPa UPsQYBw4EcXlwqNdXFjHC6JTnUNDS70EmCefMYSnXjXr/UstgwC6OBIvGDwCi9GCxQWq m4sRQXyyox1haxzolndsnlymrzcVmDyngT02gn+g0oA8DglOxorR4bCqmCeZqF42O7FY EIUSCJI6xXxLQgHYMyP3paMGuARLJSuT0Y7/IxOKJzGdSPaMmvUyhazOKp9bVOIWLYWo 0xEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RnhZlHc9; 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 77si2041470pgb.237.2019.05.29.20.41.37; Wed, 29 May 2019 20:41:54 -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=RnhZlHc9; 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 S1731871AbfE3Dkb (ORCPT + 99 others); Wed, 29 May 2019 23:40:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:34394 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731781AbfE3DV2 (ORCPT ); Wed, 29 May 2019 23:21:28 -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 837D624A1E; Thu, 30 May 2019 03:21:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559186487; bh=Z6/YzUC+RfkEHRf9NluNHAxpMB+FBj1M9LSOOh2k2gM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RnhZlHc9YQFQcNi1MtYsSfBVqsByNfzKQy7jLjWUvdf2pt2PoHMS1W6+zo5t1hkDr 3SCInp/mYr5Y4JQUNrGSa4LisoirM3ZNPet/gUovG7Nh2QUelwa3vgakbC06ipK4mB /7YFrpbTKM/tng0U4ukl/m2f1G6juOsa5UcX7ebA= 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.9 088/128] x86/build: Keep local relocations with ld.lld Date: Wed, 29 May 2019 20:07:00 -0700 Message-Id: <20190530030450.680146839@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190530030432.977908967@linuxfoundation.org> References: <20190530030432.977908967@linuxfoundation.org> User-Agent: quilt/0.66 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 [ 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 b5226a009973f..2996a1d0a410a 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