Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932759AbeAHVEE (ORCPT + 1 other); Mon, 8 Jan 2018 16:04:04 -0500 Received: from wtarreau.pck.nerim.net ([62.212.114.60]:39015 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932287AbeAHVEC (ORCPT ); Mon, 8 Jan 2018 16:04:02 -0500 Date: Mon, 8 Jan 2018 22:03:55 +0100 From: Willy Tarreau To: Thomas Gleixner Cc: Linus Torvalds , Linux Kernel Mailing List , the arch/x86 maintainers , One Thousand Gnomes , Andy Lutomirski Subject: Re: [PATCH RFC 2/4] x86/arch_prctl: add ARCH_GET_NOPTI and ARCH_SET_NOPTI to enable/disable PTI Message-ID: <20180108210355.GA11256@1wt.eu> References: <1515427939-10999-1-git-send-email-w@1wt.eu> <1515427939-10999-3-git-send-email-w@1wt.eu> <20180108182234.GL10913@1wt.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Mon, Jan 08, 2018 at 09:49:23PM +0100, Thomas Gleixner wrote: > On Mon, 8 Jan 2018, Willy Tarreau wrote: > > On Mon, Jan 08, 2018 at 09:54:05AM -0800, Linus Torvalds wrote: > > > > > So make the thing per-mm, and then at task switch time as you switch > > > mms, you set the bit in a percpu variable for testing at kernel entry. > > > > I'll see how to do that, this is not yet 100% clear to me, I'm still > > discovering (this code has immensely changed since last time I *really* > > dug into it). So I suspect I'll have to set this variable in > > __switch_to() based on this other MM flag. > > The right thing is probably the cpu entry area because that's what you can > access before switching CR3 if PTI is enabled for the task In fact I didn't need any such thing, because when coming from user space I can simply check CR3.12 : if 0, we had PTI disabled for the task, otherwise it's enabled. I'll repost the cleaned up series ASAP, unfortunately I need to go now. Thanks, Willy