Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754195AbbGWVIK (ORCPT ); Thu, 23 Jul 2015 17:08:10 -0400 Received: from wtarreau.pck.nerim.net ([62.212.114.60]:7033 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753967AbbGWVIG (ORCPT ); Thu, 23 Jul 2015 17:08:06 -0400 Date: Thu, 23 Jul 2015 23:07:23 +0200 From: Willy Tarreau To: Andy Lutomirski Cc: Linus Torvalds , X86 ML , "linux-kernel@vger.kernel.org" , Borislav Petkov , Thomas Gleixner , Peter Zijlstra , Steven Rostedt , Brian Gerst Subject: Re: Dealing with the NMI mess Message-ID: <20150723210723.GB3052@1wt.eu> References: <20150723205207.GA3052@1wt.eu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1805 Lines: 42 On Thu, Jul 23, 2015 at 01:53:34PM -0700, Andy Lutomirski wrote: > On Thu, Jul 23, 2015 at 1:52 PM, Willy Tarreau wrote: > > On Thu, Jul 23, 2015 at 01:38:33PM -0700, Linus Torvalds wrote: > >> On Thu, Jul 23, 2015 at 1:21 PM, Andy Lutomirski wrote: > >> > > >> > 2. Forbid IRET inside NMIs. Doable but maybe not that pretty. > >> > > >> > We haven't considered: > >> > > >> > 3. Forbid faults (other than MCE) inside NMI. > >> > >> I'd really prefer #2. #3 depends on us getting many things right, and > >> never introducing new cases in the future. > >> > >> #2, in contrast, seems to be fairly localized. Yes, RF is an issue, > >> but returning to user space with RF clear doesn't really seem to be > >> all that problematic. > > > > What's the worst case that can happen with RF cleared when returing > > to user space ? My understanding is that it's just that we risk to > > break again on an instruction that had a break point set and which > > already triggered the breakpoint, right ? > > I assume Linus meant returning to kernel space with RF clear. Returns > to userspace have their own fancy logic here, and it's survived for a > couple of releases, including through an explicit test of RF handling > :) Ah you must be right, got it. Yes you want to break into the NMI handler and you either disable all breakpoints/single-step until the NMI's iret by clearing DR7, or you loop over and over on the same instruction if you try to restart the stopped instruction with RF clear. That makes sense. Thanks, Willy -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/