Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2256731imm; Thu, 19 Jul 2018 16:35:09 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf6H12mThIUVAU+ffscCaDXC0h/9wLX7CBeHNNOMl19113wSdlo9+jT6OIPFWrmvRPJ9rs/ X-Received: by 2002:a65:49c7:: with SMTP id t7-v6mr11917423pgs.23.1532043309785; Thu, 19 Jul 2018 16:35:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532043309; cv=none; d=google.com; s=arc-20160816; b=ZrGTrY+T1AEs7JOBjcNi186gfSBJFcTZZc6SJFq5e6hv043H/zOqt8JHHPwDml3xxb zJ3g4YPCAuJldgi52FEtSv93s95VRZdmlbEFxwqhJ7LPeVyGVCqq0J9DzgwJG1TeXN2z F3b0ntt64Bmn446UTaNvCFHZemYTeUnN5Wnz4fFgI8CMk182hIfIJhmBWw02SSxgbFxq Z1qz4w7USrQPzDWsViOLh2k5fBxps63jCFV7vO83+Cu1d5QqB9VubEiER6BtPPHzI4dl wXEd9T6aIoOSkd9CdTkJHR90tGA0iPfsFU5cUHjJ8/X+SU9tlo/eTalaF2ImdAQPRTSQ +pMw== 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=9VwTmht2Y1ShAme3PiVhNbf9se/d8YqgPLOGkqzcWQQ=; b=DDPzFUPX0q5Qzl9Ba2u67C6N1CXqo7/XEkAuLYhGkSxKouNVGBPHttVKGhp0aYQLAC Naj/IAmY+SY4QtCsyHoELLnUwt4o1bqp09YbS3nJM7/4CY/RNspP3MHuiVOh7p6U1T1P GDX65zttk+8DFlV+SM8/ndxpoBjXyLIWC7EZxQjb4xxAvpf/IFGA22sLy8hv9vt5qoMU 1wY3extN3Fneljz2JTrx4+FZriYO2RaYPC9ohFiIm7xWxcwAngiKnusdh9sXT2iFs+VI 2zNY/GTyAA7K6XTS4XmYLB5N6wqrASIEirWUXNLRDSHZYd+96fj3iWbNGAvIDEpiRyXe FLPw== 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 b8-v6si358130pls.392.2018.07.19.16.34.55; Thu, 19 Jul 2018 16:35:09 -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 S1731178AbeGTATh (ORCPT + 99 others); Thu, 19 Jul 2018 20:19:37 -0400 Received: from terminus.zytor.com ([198.137.202.136]:48189 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730369AbeGTATh (ORCPT ); Thu, 19 Jul 2018 20:19:37 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w6JNXFLk2454141 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 19 Jul 2018 16:33:15 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w6JNXFIY2454138; Thu, 19 Jul 2018 16:33:15 -0700 Date: Thu, 19 Jul 2018 16:33:15 -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: torvalds@linux-foundation.org, jpoimboe@redhat.com, dave.hansen@intel.com, tglx@linutronix.de, peterz@infradead.org, pavel@ucw.cz, bp@alien8.de, luto@kernel.org, mingo@kernel.org, boris.ostrovsky@oracle.com, jkosina@suse.cz, aarcange@redhat.com, David.Laight@aculab.com, hpa@zytor.com, dvlasenk@redhat.com, will.deacon@arm.com, jgross@suse.com, linux-kernel@vger.kernel.org, dhgutteridge@sympatico.ca, llong@redhat.com, brgerst@gmail.com, jroedel@suse.de, eduval@amazon.com, gregkh@linuxfoundation.org Reply-To: pavel@ucw.cz, bp@alien8.de, torvalds@linux-foundation.org, dave.hansen@intel.com, jpoimboe@redhat.com, tglx@linutronix.de, peterz@infradead.org, luto@kernel.org, mingo@kernel.org, jkosina@suse.cz, boris.ostrovsky@oracle.com, aarcange@redhat.com, jgross@suse.com, linux-kernel@vger.kernel.org, dhgutteridge@sympatico.ca, hpa@zytor.com, David.Laight@aculab.com, dvlasenk@redhat.com, will.deacon@arm.com, gregkh@linuxfoundation.org, brgerst@gmail.com, llong@redhat.com, jroedel@suse.de, eduval@amazon.com In-Reply-To: <1531906876-13451-29-git-send-email-joro@8bytes.org> References: <1531906876-13451-29-git-send-email-joro@8bytes.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/pti] x86/mm/pti: Keep permissions when cloning kernel text in pti_clone_kernel_text() Git-Commit-ID: 1ac228a7c87f697d1d01eb6362a6b5246705b0dd 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=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_96_Q autolearn=ham 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: 1ac228a7c87f697d1d01eb6362a6b5246705b0dd Gitweb: https://git.kernel.org/tip/1ac228a7c87f697d1d01eb6362a6b5246705b0dd Author: Joerg Roedel AuthorDate: Wed, 18 Jul 2018 11:41:05 +0200 Committer: Thomas Gleixner CommitDate: Fri, 20 Jul 2018 01:11:45 +0200 x86/mm/pti: Keep permissions when cloning kernel text in pti_clone_kernel_text() 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. 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-29-git-send-email-joro@8bytes.org --- arch/x86/mm/pti.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c index 453d23760941..e41ee93c430d 100644 --- a/arch/x86/mm/pti.c +++ b/arch/x86/mm/pti.c @@ -482,7 +482,7 @@ void pti_clone_kernel_text(void) * pti_set_kernel_image_nonglobal() did to clear the * global bit. */ - pti_clone_pmds(start, end, _PAGE_RW); + pti_clone_pmds(start, end, 0); } /*