Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753477AbeAJTkT (ORCPT + 1 other); Wed, 10 Jan 2018 14:40:19 -0500 Received: from wtarreau.pck.nerim.net ([62.212.114.60]:39518 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751486AbeAJTkR (ORCPT ); Wed, 10 Jan 2018 14:40:17 -0500 Date: Wed, 10 Jan 2018 20:39:21 +0100 From: Willy Tarreau To: Andy Lutomirski Cc: Peter Zijlstra , LKML , X86 ML , Borislav Petkov , Brian Gerst , Dave Hansen , Ingo Molnar , Linus Torvalds , Thomas Gleixner , Josh Poimboeuf , "H. Peter Anvin" , Greg Kroah-Hartman , Kees Cook Subject: Re: [RFC PATCH v2 6/6] x86/entry/pti: don't switch PGD on when pti_disable is set Message-ID: <20180110193921.GA14378@1wt.eu> References: <1515502580-12261-1-git-send-email-w@1wt.eu> <1515502580-12261-7-git-send-email-w@1wt.eu> <20180110082207.GX29822@worktop.programming.kicks-ass.net> <20180110091102.GH14066@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: Hi Andy, On Wed, Jan 10, 2018 at 11:21:15AM -0800, Andy Lutomirski wrote: > > If we agree on this, I'd like to propose to have two flags : > > > > - TIF_DISABLE_PTI_NOW : disable PTI for the current task, reset by execve() > > - TIF_DISABLE_PTI_NEXT : disable PTI after execve(), reset by execve() > > I really dislike state that isn't cleared on execve(). I'm assuming > that this is so you can run time pwn_me_without_pti whatever? Yes exactly. I've just sent a 3rd series with an example code for this. In fact it's not that the state is not cleared by execve(), it's that it's set for the next execve() which then resets it. > Surely LD_PRELOAD can do this, too? That was one of my other proposals. I really don't know if LD_PRELOAD fits anyone's usage for such things (static/setuid binaries, complication to pass variables maybe). Please take a look and tell me if you still dislike it or not. thanks! Willy