From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f200.google.com (mail-wr0-f200.google.com [209.85.128.200]) by kanga.kvack.org (Postfix) with ESMTP id 82B656B002F for ; Mon, 23 Apr 2018 11:47:58 -0400 (EDT) Received: by mail-wr0-f200.google.com with SMTP id a38-v6so19257554wra.10 for ; Mon, 23 Apr 2018 08:47:58 -0700 (PDT) Received: from theia.8bytes.org (8bytes.org. [2a01:238:4383:600:38bc:a715:4b6d:a889]) by mx.google.com with ESMTPS id t2si10319554edf.433.2018.04.23.08.47.56 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Apr 2018 08:47:56 -0700 (PDT) From: Joerg Roedel Subject: [PATCH 28/37] x86/mm/pti: Map kernel-text to user-space on 32 bit kernels Date: Mon, 23 Apr 2018 17:47:31 +0200 Message-Id: <1524498460-25530-29-git-send-email-joro@8bytes.org> In-Reply-To: <1524498460-25530-1-git-send-email-joro@8bytes.org> References: <1524498460-25530-1-git-send-email-joro@8bytes.org> Sender: owner-linux-mm@kvack.org List-ID: To: Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" Cc: x86@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Linus Torvalds , Andy Lutomirski , Dave Hansen , Josh Poimboeuf , Juergen Gross , Peter Zijlstra , Borislav Petkov , Jiri Kosina , Boris Ostrovsky , Brian Gerst , David Laight , Denys Vlasenko , Eduardo Valentin , Greg KH , Will Deacon , aliguori@amazon.com, daniel.gruss@iaik.tugraz.at, hughd@google.com, keescook@google.com, Andrea Arcangeli , Waiman Long , Pavel Machek , "David H . Gutteridge" , jroedel@suse.de, joro@8bytes.org From: Joerg Roedel Keeping the kernel text mapped with G bit set keeps its entries in the TLB across kernel entry/exit and improved the performance. The 64 bit x86 kernels already do this when there is no PCID, so do this in 32 bit as well since PCID is not even supported there. Signed-off-by: Joerg Roedel --- arch/x86/mm/init_32.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c index c893c6a..8299b98 100644 --- a/arch/x86/mm/init_32.c +++ b/arch/x86/mm/init_32.c @@ -956,4 +956,10 @@ void mark_rodata_ro(void) mark_nxdata_nx(); if (__supported_pte_mask & _PAGE_NX) debug_checkwx(); + + /* + * Do this after all of the manipulation of the + * kernel text page tables are complete. + */ + pti_clone_kernel_text(); } -- 2.7.4