Received: by 10.213.65.68 with SMTP id h4csp848782imn; Tue, 27 Mar 2018 09:54:31 -0700 (PDT) X-Google-Smtp-Source: AIpwx48fTDhqjLsKMwTSuEJDRqKTFVyw7buBkVkHoj2qYbft8DqLDKnY9EHHQtvCCLb+L/Wiw8Pr X-Received: by 10.99.163.9 with SMTP id s9mr55998pge.187.1522169671234; Tue, 27 Mar 2018 09:54:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522169671; cv=none; d=google.com; s=arc-20160816; b=d4DQzl0mVoQN/64uPU580mTP8pTyEPKf41A17Y0RM24WxKgFU6klTIbZXKgAOh4Plx 6Ft7erOE6XoXDUdYvfSB3hGGb1f4uizdHN/c6cT7TT0qxzBGHp8YIyLBNFDCbIUqbtnD Bo+erUxHwVjj/nLoBc2R4VjzOB4pI+Xw74d4lbsnTf9Vukx2Ocu6g0JykJt0uE5IRvUJ s40RZ5nH51vYi7blEsLWJHrbUOX60dzshxdpDLDKge3XjP/XoqiGpK/8VSStIv3pB5Wd 0E9bJI3oE0W26XV/5eV52WqUY687iIXHBXgIEpuKySSJoa04U63bj+GU2GUGJtiHymPP tgYg== 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=o4Cwe8DoPVSpkjUvOqTN/6t7LepiozWApqir6VG+Xic=; b=qMTeaXTDoKouuop/OFhJUEn26pO3XkObiYsgT62vbjy+eByh46D/+Q3biKKNFAfOIy WL2Q4Fs25JEj6aFb+fjpBT1ZK2XjtSUTEbhtiN57exSVX9Mcgm7Oqn1Z1R76/1qT6QMN K+9V+ehqSKrdoY4IqrPbY9crD8w+IYAi5lyp435irtPbrWHVCwHOas2HuzrPFvyjzpoI FjWcC9K3gVjge6q9qv+hwUF73RdbMq6PZY+heu1B1NCHRpgp62bcFdlm75OIyXADLeCd i0LoOoiyHUrnZuLoBXtUty16Zsz4YTw/eEkDPeHonSMGtY+y4iv1o72Mk0OzPa3+Md+E J3sw== 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 c4si1130380pgu.355.2018.03.27.09.54.15; Tue, 27 Mar 2018 09:54:31 -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 S1752277AbeC0Qvg (ORCPT + 99 others); Tue, 27 Mar 2018 12:51:36 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:49090 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932751AbeC0Qm2 (ORCPT ); Tue, 27 Mar 2018 12:42:28 -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 812EFF98; Tue, 27 Mar 2018 16:42:27 +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.15 089/105] x86/build/64: Force the linker to use 2MB page size Date: Tue, 27 Mar 2018 18:28:09 +0200 Message-Id: <20180327162803.635579937@linuxfoundation.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180327162757.813009222@linuxfoundation.org> References: <20180327162757.813009222@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.15-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