Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2256244imm; Thu, 19 Jul 2018 16:34:32 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc2uFze3KFhV6P6ngvocU7xIx1fftl8N6CX6CVCnP8l9m7VxmduornOAaxOrGxes25DWlJQ X-Received: by 2002:a65:620b:: with SMTP id d11-v6mr12006131pgv.429.1532043272417; Thu, 19 Jul 2018 16:34:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532043272; cv=none; d=google.com; s=arc-20160816; b=oY4JHfq1seuUGyL19SGXpRfRBgm83uas+H3it9IpoYos4pLPNBbw++IUcaVSKLTBBe Qi0jMZTe+UeqqBNFfjbrCuLCQxbnCZMmThIvbgHffHiN50kqdz9gaOcZp+kCuaxqg/m5 nr+W30dZDsra7hSiD9203bZfPVlUH93DMDvKWsMplL+brj8MSMyFt2eVxTk8XreTeuJd sTdDAauUDim3Jv2RhLPQrwwguQXgDXjYljkGwaIdMyRuxstpxA9OXjUJ5cv74IDtPjM9 6CsD3TjhdPuAMqHWaKfwoTKwNeWHrN3BE1vfRGqSFw7zbl+6hJ1TWrrmuhQDLRdfh8Wf 8udg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=v6TgE3BuvyzOWH1m/Gl6xd2Vjp1XNKI6DIKROFDlmbc=; b=BxZo5al5mdlzsYWLs0eUBWnGrM02bsPu8jNlSVfLolIeUohfO/wDzqRNRskD7IVK2y SIjTaxfIF8F6rtdfKMD9w2U++8MIgFAOhz2PJ1frkwe6+lsBIKe88dZOPMj1lK61QVZF BKPjv6DFHY//+rrDkfDYCatf0CZ0c2dg5iHVXQoggcrDNk4t9ouemGT/NXjg5e1Tf14l Aoas+oR8Qk+RYihLuhdr3FUnGpJp4ha0ufZKAv9d09vDg343furi1xNWx3hoe6ZFkd3x 6gXJ2JjSB14xsrDZg58y7VaSO5EYsUwSlX4czgyU7xeS+t6a+/34aq0CfP9Ex59q3b9U k/rg== 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 200-v6si391350pgf.378.2018.07.19.16.34.16; Thu, 19 Jul 2018 16:34:32 -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 S1731379AbeGTATF (ORCPT + 99 others); Thu, 19 Jul 2018 20:19:05 -0400 Received: from terminus.zytor.com ([198.137.202.136]:36907 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730369AbeGTATF (ORCPT ); Thu, 19 Jul 2018 20:19:05 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w6JNWgrZ2453940 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 19 Jul 2018 16:32:42 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w6JNWglX2453937; Thu, 19 Jul 2018 16:32:42 -0700 Date: Thu, 19 Jul 2018 16:32:42 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Joerg Roedel Message-ID: Cc: gregkh@linuxfoundation.org, boris.ostrovsky@oracle.com, will.deacon@arm.com, dvlasenk@redhat.com, llong@redhat.com, jkosina@suse.cz, pavel@ucw.cz, luto@kernel.org, peterz@infradead.org, torvalds@linux-foundation.org, dhgutteridge@sympatico.ca, eduval@amazon.com, jgross@suse.com, tglx@linutronix.de, bp@alien8.de, brgerst@gmail.com, David.Laight@aculab.com, jroedel@suse.de, dave.hansen@intel.com, jpoimboe@redhat.com, linux-kernel@vger.kernel.org, hpa@zytor.com, aarcange@redhat.com, mingo@kernel.org Reply-To: brgerst@gmail.com, bp@alien8.de, tglx@linutronix.de, jgross@suse.com, mingo@kernel.org, hpa@zytor.com, aarcange@redhat.com, jpoimboe@redhat.com, linux-kernel@vger.kernel.org, dave.hansen@intel.com, jroedel@suse.de, David.Laight@aculab.com, jkosina@suse.cz, llong@redhat.com, dvlasenk@redhat.com, will.deacon@arm.com, boris.ostrovsky@oracle.com, gregkh@linuxfoundation.org, eduval@amazon.com, dhgutteridge@sympatico.ca, torvalds@linux-foundation.org, peterz@infradead.org, luto@kernel.org, pavel@ucw.cz In-Reply-To: <1531906876-13451-28-git-send-email-joro@8bytes.org> References: <1531906876-13451-28-git-send-email-joro@8bytes.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/pti] x86/mm/pti: Make pti_clone_kernel_text() compile on 32 bit Git-Commit-ID: 39d668e04edad25abe184fb329ce35a131146ee5 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-0.8 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_96_Q,FREEMAIL_FORGED_REPLYTO autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 39d668e04edad25abe184fb329ce35a131146ee5 Gitweb: https://git.kernel.org/tip/39d668e04edad25abe184fb329ce35a131146ee5 Author: Joerg Roedel AuthorDate: Wed, 18 Jul 2018 11:41:04 +0200 Committer: Thomas Gleixner CommitDate: Fri, 20 Jul 2018 01:11:44 +0200 x86/mm/pti: Make pti_clone_kernel_text() compile on 32 bit The pti_clone_kernel_text() function references __end_rodata_hpage_align, which is only present on x86-64. This makes sense as the end of the rodata section is not huge-page aligned on 32 bit. Nevertheless a symbol is required for the function that points at the right address for both 32 and 64 bit. Introduce __end_rodata_aligned for that purpose and use it in pti_clone_kernel_text(). Signed-off-by: Joerg Roedel Signed-off-by: Thomas Gleixner Tested-by: Pavel Machek Cc: "H . Peter Anvin" Cc: linux-mm@kvack.org Cc: Linus Torvalds Cc: Andy Lutomirski Cc: Dave Hansen Cc: Josh Poimboeuf Cc: Juergen Gross Cc: Peter Zijlstra Cc: Borislav Petkov Cc: Jiri Kosina Cc: Boris Ostrovsky Cc: Brian Gerst Cc: David Laight Cc: Denys Vlasenko Cc: Eduardo Valentin Cc: Greg KH Cc: Will Deacon Cc: aliguori@amazon.com Cc: daniel.gruss@iaik.tugraz.at Cc: hughd@google.com Cc: keescook@google.com Cc: Andrea Arcangeli Cc: Waiman Long Cc: "David H . Gutteridge" Cc: joro@8bytes.org Link: https://lkml.kernel.org/r/1531906876-13451-28-git-send-email-joro@8bytes.org --- arch/x86/include/asm/sections.h | 1 + arch/x86/kernel/vmlinux.lds.S | 17 ++++++++++------- arch/x86/mm/pti.c | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/arch/x86/include/asm/sections.h b/arch/x86/include/asm/sections.h index 5c019d23d06b..4a911a382ade 100644 --- a/arch/x86/include/asm/sections.h +++ b/arch/x86/include/asm/sections.h @@ -7,6 +7,7 @@ extern char __brk_base[], __brk_limit[]; extern struct exception_table_entry __stop___ex_table[]; +extern char __end_rodata_aligned[]; #if defined(CONFIG_X86_64) extern char __end_rodata_hpage_align[]; diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S index 5e1458f609a1..8bde0a419f86 100644 --- a/arch/x86/kernel/vmlinux.lds.S +++ b/arch/x86/kernel/vmlinux.lds.S @@ -55,19 +55,22 @@ jiffies_64 = jiffies; * so we can enable protection checks as well as retain 2MB large page * mappings for kernel text. */ -#define X64_ALIGN_RODATA_BEGIN . = ALIGN(HPAGE_SIZE); +#define X86_ALIGN_RODATA_BEGIN . = ALIGN(HPAGE_SIZE); -#define X64_ALIGN_RODATA_END \ +#define X86_ALIGN_RODATA_END \ . = ALIGN(HPAGE_SIZE); \ - __end_rodata_hpage_align = .; + __end_rodata_hpage_align = .; \ + __end_rodata_aligned = .; #define ALIGN_ENTRY_TEXT_BEGIN . = ALIGN(PMD_SIZE); #define ALIGN_ENTRY_TEXT_END . = ALIGN(PMD_SIZE); #else -#define X64_ALIGN_RODATA_BEGIN -#define X64_ALIGN_RODATA_END +#define X86_ALIGN_RODATA_BEGIN +#define X86_ALIGN_RODATA_END \ + . = ALIGN(PAGE_SIZE); \ + __end_rodata_aligned = .; #define ALIGN_ENTRY_TEXT_BEGIN #define ALIGN_ENTRY_TEXT_END @@ -141,9 +144,9 @@ SECTIONS /* .text should occupy whole number of pages */ . = ALIGN(PAGE_SIZE); - X64_ALIGN_RODATA_BEGIN + X86_ALIGN_RODATA_BEGIN RO_DATA(PAGE_SIZE) - X64_ALIGN_RODATA_END + X86_ALIGN_RODATA_END /* Data */ .data : AT(ADDR(.data) - LOAD_OFFSET) { diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c index a594e3b6401a..453d23760941 100644 --- a/arch/x86/mm/pti.c +++ b/arch/x86/mm/pti.c @@ -470,7 +470,7 @@ void pti_clone_kernel_text(void) * clone the areas past rodata, they might contain secrets. */ unsigned long start = PFN_ALIGN(_text); - unsigned long end = (unsigned long)__end_rodata_hpage_align; + unsigned long end = (unsigned long)__end_rodata_aligned; if (!pti_kernel_image_global_ok()) return;