Received: by 10.223.185.116 with SMTP id b49csp8418870wrg; Fri, 2 Mar 2018 01:09:14 -0800 (PST) X-Google-Smtp-Source: AG47ELtVN9osPKKg1nKxDPcAefxGz+pUtDy04atL1PVlYjR9bQPiFyWn694NAeQcAwKRgjGXPWif X-Received: by 2002:a17:902:8608:: with SMTP id f8-v6mr4760252plo.366.1519981753930; Fri, 02 Mar 2018 01:09:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519981753; cv=none; d=google.com; s=arc-20160816; b=kth7WY6w2Zp9+tabMQWVR5iAlsNNcG+VqyPBQpIV1/pjPvJ4lt4xs2xj4kyIugoMJ8 tcYv08DKWHGMQcMMcuMqKwFI9hbI6z5d7FqpT2k6YgJSP4Vi28YUT1Xnwln+FloP9Y0j YwM8YgUmmomfBts79g1vehdrJiO6j2rGqfs0Ks50UA5n0SvQuyn8td4Bccjy29sPX0N1 HO1xhq/wnjy1AIwc2e5RlCtTMdVVYFm2xmfqU262MY+w7wehPRrgVm2N/e+tld2Qga12 CTxoZlpdx9iMBrTD67lB9rTIt6eFApUPiXB78sHSwXShJQ0uKWuvDUnH+YYDiQ6IoaAP dDtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=PU7EPMVKak34ckKvfYRXb97B5t49eWkZpEfK/TDi5t4=; b=a1uu3FWRJargUXkVJlP3Ln7G76+0R7CpfMngN/OIkOuc2GrEGdDSqKohua+LrOwKti zWoodEN98nagVCnU4j7s6Rqb1tP2WypYSsYwJTw+xLUYFrUVEh1TJ1jDtQDhuxGf0sY1 AlJkNqiYI70EWzLLyB5RjJtcfWa6oKMeNZp8LV9BdGTPtslKGQB8DLZp6Bv3vodA1VQO MScCsVxxmgfphsJc1Sm+PqbQlyBwkC4of/yTyC9K23rTHNJ93oXGaNZF4N5byDukOrm9 2X06tz8n0Ckqb3o6HEf1Sp7RnafVNB+HwuC6vzqWhjjV8mVaIfRLlhEld6bX/nUc2AOS lMmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@8bytes.org header.s=mail-1 header.b=can9wVTh; 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=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v62si2393192pfi.156.2018.03.02.01.08.58; Fri, 02 Mar 2018 01:09:13 -0800 (PST) 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=fail (test mode) header.i=@8bytes.org header.s=mail-1 header.b=can9wVTh; 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=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1425372AbeCBJHr (ORCPT + 99 others); Fri, 2 Mar 2018 04:07:47 -0500 Received: from 8bytes.org ([81.169.241.247]:53620 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1425363AbeCBJHj (ORCPT ); Fri, 2 Mar 2018 04:07:39 -0500 Received: by theia.8bytes.org (Postfix, from userid 1000) id CD6A359B; Fri, 2 Mar 2018 10:07:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=8bytes.org; s=mail-1; t=1519981657; bh=Dvel9BIf4N4ZwZj59F8/uK7VTgfB6/Z7O1FTTbh61q4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=can9wVThXShCaJJ2sYePe4ppid/kAp8z5uFDaR/mNszyx7HaPMHpR1Uh+zVIt24DP uNyDYYyQosDKdSyyuzd6XGZ1MHxbPQ12Sv4rfKFJ28y9SFnl/GJl5VSw2b2jwvKg6+ Wo6btrypgOJpm5ImLxTEzfFTIhH+uTIueJD5TsSTRs6XIFces9higiQpMeHEdAvi19 r1C3FFm5N6WSsiDtUMqIJFQZZ1911CAk0/6F9wxKgcJh38PTOVSlD8MMmJvsyZ1gmL q1AduzWHoB0m98+ddLeAk+FZHSbsookMr4SRhQwn06UJS0rx3Sd/KxYQpQ0YMFu0dY //vzeQr/dXHCg== Date: Fri, 2 Mar 2018 10:07:37 +0100 From: Joerg Roedel To: Brian Gerst Cc: Joerg Roedel , Waiman Long , Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , the arch/x86 maintainers , Linux Kernel Mailing List , Linux-MM , Linus Torvalds , Andy Lutomirski , Dave Hansen , Josh Poimboeuf , Juergen Gross , Peter Zijlstra , Borislav Petkov , Jiri Kosina , Boris Ostrovsky , David Laight , Denys Vlasenko , Eduardo Valentin , Greg KH , Will Deacon , "Liguori, Anthony" , Daniel Gruss , Hugh Dickins , Kees Cook , Andrea Arcangeli , Waiman Long , Pavel Machek Subject: Re: [PATCH 12/31] x86/entry/32: Add PTI cr3 switch to non-NMI entry/exit points Message-ID: <20180302090737.GO16484@8bytes.org> References: <1518168340-9392-1-git-send-email-joro@8bytes.org> <1518168340-9392-13-git-send-email-joro@8bytes.org> <20180301133430.wda4qesqhxnww7d6@8bytes.org> <2ae8b01f-844b-b8b1-3198-5db70c3e083b@redhat.com> <20180301165019.kuynvb6fkcwdpxjx@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 01, 2018 at 01:24:39PM -0500, Brian Gerst wrote: > The IF flag only affects external maskable interrupts, not traps or > faults. You do need to check CR3 because SYSENTER does not clear TF > and will immediately cause a debug trap on kernel entry (with user > CR3) if set. That is why the code existed before to check for the > entry stack for debug/NMI. Yeah, okay, thanks for the clarification. This also means the #DB handler needs to leave with the same cr3 as it entered. I'll work that into my patches. Thanks, Joerg