Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp30659imm; Fri, 13 Jul 2018 16:26:38 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcPJn1FSA+MPFQQ+JO6+QUQnoU7cFo4uYJ0mLBIsRX1bD2egZgQAMVFgzpHns+rDDxy8wC8 X-Received: by 2002:a63:5a5e:: with SMTP id k30-v6mr7945914pgm.123.1531524398904; Fri, 13 Jul 2018 16:26:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531524398; cv=none; d=google.com; s=arc-20160816; b=BdrFv2+6230q9q7FRjySpLfTWbdm/V5IlBDpMtd7QWCvvqsHnoPutBewF1qQJRbroV eK8q8gLJAw4TI5i4FVIfNMkKsk9rAPH1WaYWH99gAuq0s9VwVGv2xMByBILtaiJyyK5/ 8Vht3TD9e4BneT4RZoakxebBflha7DKPLGtd7KcD+XvSNDmp59wXeRszVxKeytAejHTa 7M2aWkZ67L5FiaLDhePVbS6SYniv4V3HRXGksuEuj60uq/oIKGo39+HuhLyCPuHnlqi2 yesdsouPVPaBD/DzftseTQX4FOnSvu5JMoxTxqkPV6AIduAHVCa9AFQ5Hs28oN1EgC52 6mQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=/f79sG+Td8iAA19gXpz4KoUiWcsDyooJqq/0cfEvezU=; b=it/AlIcZ1zFZzmP2GZFa/x9WAoAxggH3IxL/iuSksGFklLsYHyPyHEgpxWUfSAtrO0 20mNRI54qwbY2M8kw0uhkYN42c3BjpZIlhQj+uhduYsMuEBpkVtV9Wr9YJn6imUmsq1A KsaFiUctDR4khIjPZEyAJt7HIgUjm3oJ3yei3Mw+FkknvGQJAaYn59bxITmBvwsy2cXN NVhnk8yDPneStotNBH5DVBmH/VRolrvmdiPczwWZifNxEMjqEjMm+XuSFqsBSJu0Nb5W ZwG4cv3zLre+tMHAL3gHzNv5btJ9PYcSzBliSNi21l+C9ATgxaWnzOgYIDv0fWYm3Xne DEEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JjBIKEc+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c2-v6si24718186plb.77.2018.07.13.16.26.23; Fri, 13 Jul 2018 16:26:38 -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; dkim=pass header.i=@kernel.org header.s=default header.b=JjBIKEc+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730683AbeGMXme (ORCPT + 99 others); Fri, 13 Jul 2018 19:42:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:40558 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729626AbeGMXme (ORCPT ); Fri, 13 Jul 2018 19:42:34 -0400 Received: from mail-wm0-f43.google.com (mail-wm0-f43.google.com [74.125.82.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 89830208A4 for ; Fri, 13 Jul 2018 23:25:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1531524347; bh=/f79sG+Td8iAA19gXpz4KoUiWcsDyooJqq/0cfEvezU=; h=In-Reply-To:References:From:Date:Subject:To:Cc:From; b=JjBIKEc+15d6H1YJyQg1G+Fp9S4gqGhuFsI593T7rIoN/9vPe58VilmpHNKlJtRo8 d0oQElIJyzSlsj546y1Rw0Glzq7mcHwhOKtMcSUGyFXod5r6YWyKPAdqZQL7bs5f/R 9xyGY1yFzfysOlx72ouwcu2TBYWZ0/SBOQTeO9Cs= Received: by mail-wm0-f43.google.com with SMTP id 69-v6so10669620wmf.3 for ; Fri, 13 Jul 2018 16:25:47 -0700 (PDT) X-Gm-Message-State: AOUpUlGvoNTo6LszBXPUF1js7cOY/Yy7rbqB/lmSrM2R/+JGnImEImMK fLTGd522aNzUNrYMrhLEfe6v+lgoCgwdDstlVM7PvA== X-Received: by 2002:a1c:8313:: with SMTP id f19-v6mr4684469wmd.144.1531524346058; Fri, 13 Jul 2018 16:25:46 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a1c:d548:0:0:0:0:0 with HTTP; Fri, 13 Jul 2018 16:25:25 -0700 (PDT) In-Reply-To: <1531308586-29340-29-git-send-email-joro@8bytes.org> References: <1531308586-29340-1-git-send-email-joro@8bytes.org> <1531308586-29340-29-git-send-email-joro@8bytes.org> From: Andy Lutomirski Date: Fri, 13 Jul 2018 16:25:25 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 28/39] x86/mm/pti: Keep permissions when cloning kernel text in pti_clone_kernel_text() 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 , "Liguori, Anthony" , Daniel Gruss , Hugh Dickins , Kees Cook , Andrea Arcangeli , Waiman Long , Pavel Machek , "David H . Gutteridge" , Joerg Roedel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 11, 2018 at 4:29 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. Reviewed-by: Andy Lutomirski