Received: by 10.213.65.68 with SMTP id h4csp909798imn; Tue, 27 Mar 2018 11:01:33 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+nPCg9OwxWONHGfgnRwOwbG8M8UOP9isCnPGx6xf0XAH8zKCV+ygtwjDK9rYmKbwI2Eyq5 X-Received: by 2002:a17:902:6b07:: with SMTP id o7-v6mr328227plk.136.1522173693915; Tue, 27 Mar 2018 11:01:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522173693; cv=none; d=google.com; s=arc-20160816; b=uyjtO2LjYK1SVR+k3rhssjx+t2ybgF+5ee1KYMrfYVkbqHhwXA6eBHkJ9/Pf68gG32 gb4DJhnKRsseTF2T0Bm5B60HpG7QiQUyIuOnz0rEXb2rXrXdHYFUfRBthYcnB1BMM601 Fpf6YfBoD6qtjFk5RPi/1bYuOuwcAZcyl9H+iby8OMcxvCbPiRhJN+YYlp4B9W+CtLdV UTd3vjNimVwwoodqwzY7CVY5lFOFIfORAHcytizmwhccpawTq9byAiQd5aICzILMTanG 8N0MPLkGKScDmrR/MkryBolU0QMxTG1ooeS9wFzddPfS0Ap0jM9jN3Gc7jSL1DvZl2jf X6zg== 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=oGCXsyz6tlTFBC3JUFNOSzZsCqA/QNQ041bpstTSZNY=; b=kwmecsb3InuJFBvzHd/pyN5vU0TbR9lrb6DiLS+TFhA1SenKaZCw+/e9PuD06KXCci kOstoAz3zJrZmnbRj9/2+kbouFHLu66zCLlqSgH56FiK6392B0oC+V9k5e3ZFBUDXya1 yodE5eQNljfJ3OI6VtlXIVgEy6y/NQAcLQrLTLzK6TK2lyiOxaYQshZ9+07Eg1/NAUyW AzZD1AEwkhBblS2LHqT/XFeSNuWwR67c+HWV9tMiZeCb3l3DBAIlowX3Hm8QNTauSUgh +/QacdJYksViXB5UBX2i9L1QkLWCZdXJv8Ag2fOgY1l0Yf0WPAW9POQVZ+/h8mgtLl5B wJkA== 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 o4si1177856pga.175.2018.03.27.11.01.18; Tue, 27 Mar 2018 11:01:33 -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 S1753038AbeC0QaU (ORCPT + 99 others); Tue, 27 Mar 2018 12:30:20 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:41720 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753001AbeC0QaQ (ORCPT ); Tue, 27 Mar 2018 12:30:16 -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 EC6851160; Tue, 27 Mar 2018 16:30:15 +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.4 36/43] x86/build/64: Force the linker to use 2MB page size Date: Tue, 27 Mar 2018 18:27:40 +0200 Message-Id: <20180327162718.436018102@linuxfoundation.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180327162716.407986916@linuxfoundation.org> References: <20180327162716.407986916@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.4-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 @@ -179,6 +179,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