Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932698AbeAJI50 (ORCPT + 1 other); Wed, 10 Jan 2018 03:57:26 -0500 Received: from wtarreau.pck.nerim.net ([62.212.114.60]:39343 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755230AbeAJI5Z (ORCPT ); Wed, 10 Jan 2018 03:57:25 -0500 Date: Wed, 10 Jan 2018 09:50:16 +0100 From: Willy Tarreau To: Ingo Molnar Cc: linux-kernel@vger.kernel.org, x86@kernel.org, Andy Lutomirski , Borislav Petkov , Brian Gerst , Dave Hansen , Linus Torvalds , Peter Zijlstra , Thomas Gleixner , Josh Poimboeuf , "H. Peter Anvin" , Kees Cook Subject: Re: [RFC PATCH v2 3/6] x86/pti: add a per-cpu variable pti_disable Message-ID: <20180110085016.GE14066@1wt.eu> References: <1515502580-12261-1-git-send-email-w@1wt.eu> <1515502580-12261-4-git-send-email-w@1wt.eu> <20180110071951.t4vbwlnlw2qycnpm@gmail.com> <20180110072900.GC14066@1wt.eu> <20180110080102.7ggggtruidb53yfu@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180110080102.7ggggtruidb53yfu@gmail.com> User-Agent: Mutt/1.6.1 (2016-04-27) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Wed, Jan 10, 2018 at 09:01:02AM +0100, Ingo Molnar wrote: > > * Willy Tarreau wrote: > > > [...] If we had "pit_enabled", something like this could be confusing because > > it's not obvious whether this pti_enabled *enforces* PTI or if its absence > > disables it : > > > > cmpb $0, PER_CPU_VAR(pti_enabled) > > jz .Lend\@ > > The natural sequence would be: > > cmpb $1, PER_CPU_VAR(pti_enabled) > jne .Lend\@ > > which is not confusing to me at all. In fact I think I know now why it still poses me a problem : this pti_enabled flag alone is not sufficient to enable PTI, it's just part of the condition, as another part comes from the X86_FEATURE_PTI flag. However, pti_disabled is sufficient to disable PTI so actually its effect matches its name (note BTW that I called it "pti_disable" as a verb indicating an action -- "I want to disable pti", and not as a past form "pti is disabled"). Willy