From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vk0-f69.google.com (mail-vk0-f69.google.com [209.85.213.69]) by kanga.kvack.org (Postfix) with ESMTP id A4FBC6B000D for ; Mon, 23 Apr 2018 13:09:21 -0400 (EDT) Received: by mail-vk0-f69.google.com with SMTP id g76so8876067vki.9 for ; Mon, 23 Apr 2018 10:09:21 -0700 (PDT) Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id l65sor6207614vkb.207.2018.04.23.10.09.20 for (Google Transport Security); Mon, 23 Apr 2018 10:09:20 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1524498460-25530-29-git-send-email-joro@8bytes.org> References: <1524498460-25530-1-git-send-email-joro@8bytes.org> <1524498460-25530-29-git-send-email-joro@8bytes.org> From: Kees Cook Date: Mon, 23 Apr 2018 10:09:19 -0700 Message-ID: Subject: Re: [PATCH 28/37] x86/mm/pti: Map kernel-text to user-space on 32 bit kernels Content-Type: text/plain; charset="UTF-8" Sender: owner-linux-mm@kvack.org List-ID: To: Joerg Roedel Cc: Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , X86 ML , LKML , Linux-MM , 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 , Anthony Liguori , Daniel Gruss , Hugh Dickins , Andrea Arcangeli , Waiman Long , Pavel Machek , "David H . Gutteridge" , Joerg Roedel On Mon, Apr 23, 2018 at 8:47 AM, Joerg Roedel wrote: > 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. I think this should keep at least part of the logic as 64-bit since there are other reasons to turn off the Global flag: https://lkml.kernel.org/r/20180420222026.D0B4AAC9@viggo.jf.intel.com -Kees > > 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 > -- Kees Cook Pixel Security