From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vk0-f70.google.com (mail-vk0-f70.google.com [209.85.213.70]) by kanga.kvack.org (Postfix) with ESMTP id 1F9B66B0008 for ; Mon, 23 Apr 2018 13:06:23 -0400 (EDT) Received: by mail-vk0-f70.google.com with SMTP id j139so7833000vke.8 for ; Mon, 23 Apr 2018 10:06:23 -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 m129sor6303112vkg.287.2018.04.23.10.06.21 for (Google Transport Security); Mon, 23 Apr 2018 10:06:22 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1524498460-25530-28-git-send-email-joro@8bytes.org> References: <1524498460-25530-1-git-send-email-joro@8bytes.org> <1524498460-25530-28-git-send-email-joro@8bytes.org> From: Kees Cook Date: Mon, 23 Apr 2018 10:06:20 -0700 Message-ID: Subject: Re: [PATCH 27/37] x86/mm/pti: Keep permissions when cloning kernel text in pti_clone_kernel_text() 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 > > Mapping the kernel text area to user-space makes only sense > if it has the same permissions as in the kernel page-table. > If permissions are different this will cause a TLB reload > when using the kernel page-table, which is as good as not > mapping it at all. > > On 64-bit kernels this patch makes no difference, as the > whole range cloned by pti_clone_kernel_text() is mapped RO > anyway. On 32 bit there are writeable mappings in the range, > so just keep the permissions as they are. Why are there R/W text mappings in this range? I find that to be unexpected. Shouldn't CONFIG_DEBUG_WX already complain if that were true? -Kees -- Kees Cook Pixel Security