Received: by 10.213.65.68 with SMTP id h4csp876737imn; Tue, 27 Mar 2018 10:24:30 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+U1KSMjM0uhgTzbJfz3EpSDn3NcZS7u83NpwifBQCP6sstcGMEia8zXAiBSD/hBchmk4aZ X-Received: by 2002:a17:902:6597:: with SMTP id c23-v6mr171701plk.321.1522171470095; Tue, 27 Mar 2018 10:24:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522171470; cv=none; d=google.com; s=arc-20160816; b=qRVFlSLgiTovRLs+j+j9ta52yQxlzGNXLqO280rawuW+iIdetybE4u7Cv0OWRFWQRx Qx/Tk/Pr/zwbhAqeigFmMSnd0LKExLf6EmaJHk6VzbPYsS1LBvGtYBgn++3GYOUJf5zT 22r0PyIVUqqopO0OH7PTrBF/3Q9AVi8C8y7c8gCqBwp61Q79MWu+1u//rV5y2O157ON/ A9IjBuRJSNqWTMdpCKDmP5yqLEn02fx6BZ8kRsgtfxennEhk5pCsVJD+Gzn2Jlo6kyOA TCE102RJZ1SME0gXw6Rq25H8KNj7pnPlvhhjFZXGsm2oGWK23fzuqUKGiBqKsICEx/fp e64g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=DR4050sX7+oSdT4mqsw1Zc3RCt5Ay0vwioEhPfg6Rsg=; b=JqDhhGt69pYKcLMdGN+ckn81gIcvmzSGQi3Gmao2SwNz2NH3dd7GLuli7/kNfWeY6D qJaZbd4BW1MHa2sct0kGcjrX1brhpBNpt0oEpVxZxWxkgAWa1sbuvfnLWcH0PiepE56f gF5qUZX5AdgthxMehjA8akX6qLkBRnOSPzP+jynmB1tvT4Qo6bzBNVZQyVUrf9GQ4wB+ /gYuS103FgnX2748Y3CUpaOuIUHGVRK1Y8+xpDrcgOT5Oc27K8Ecwudc/qk9hfMPuuc3 4ThFgF1Fck9gGYeFnXkgGzasCue6s1IYv77ZJG0paxUWscuzC7h6qLsyetZyHiWTSuqS f4Nw== ARC-Authentication-Results: i=1; mx.google.com; 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 d9si1086775pgq.598.2018.03.27.10.24.15; Tue, 27 Mar 2018 10:24:30 -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; 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 S1754969AbeC0Qhe (ORCPT + 99 others); Tue, 27 Mar 2018 12:37:34 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:46316 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754591AbeC0Qhc (ORCPT ); Tue, 27 Mar 2018 12:37:32 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 6CD21F8A; Tue, 27 Mar 2018 16:37:31 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "H.J. Lu" , Andy Shevchenko , Eric Biederman , "H. Peter Anvin" , Juergen Gross , Kees Cook , "Kirill A. Shutemov" , Linus Torvalds , Peter Zijlstra , Thomas Gleixner , Ingo Molnar Subject: [PATCH 4.14 084/101] x86/build/64: Force the linker to use 2MB page size Date: Tue, 27 Mar 2018 18:27:56 +0200 Message-Id: <20180327162755.228090618@linuxfoundation.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180327162749.993880276@linuxfoundation.org> References: <20180327162749.993880276@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: H.J. Lu commit e3d03598e8ae7d195af5d3d049596dec336f569f upstream. Binutils 2.31 will enable -z separate-code by default for x86 to avoid mixing code pages with data to improve cache performance as well as security. To reduce x86-64 executable and shared object sizes, the maximum page size is reduced from 2MB to 4KB. But x86-64 kernel must be aligned to 2MB. Pass -z max-page-size=0x200000 to linker to force 2MB page size regardless of the default page size used by linker. Tested with Linux kernel 4.15.6 on x86-64. Signed-off-by: H.J. Lu Cc: Andy Shevchenko Cc: Eric Biederman Cc: H. Peter Anvin Cc: Juergen Gross Cc: Kees Cook Cc: Kirill A. Shutemov Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/CAMe9rOp4_%3D_8twdpTyAP2DhONOCeaTOsniJLoppzhoNptL8xzA@mail.gmail.com Signed-off-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman --- arch/x86/Makefile | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -223,6 +223,15 @@ KBUILD_CFLAGS += $(cfi) $(cfi-sigframe) LDFLAGS := -m elf_$(UTS_MACHINE) +# +# The 64-bit kernel must be aligned to 2MB. Pass -z max-page-size=0x200000 to +# the linker to force 2MB page size regardless of the default page size used +# by the linker. +# +ifdef CONFIG_X86_64 +LDFLAGS += $(call ld-option, -z max-page-size=0x200000) +endif + # Speed up the build KBUILD_CFLAGS += -pipe # Workaround for a gcc prelease that unfortunately was shipped in a suse release