Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754262AbbGWVrP (ORCPT ); Thu, 23 Jul 2015 17:47:15 -0400 Received: from mail-lb0-f177.google.com ([209.85.217.177]:36608 "EHLO mail-lb0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753863AbbGWVrK (ORCPT ); Thu, 23 Jul 2015 17:47:10 -0400 MIME-Version: 1.0 In-Reply-To: <20150723214603.GD3052@1wt.eu> References: <20150723173105.6795c0dc@gandalf.local.home> <20150723214603.GD3052@1wt.eu> From: Andy Lutomirski Date: Thu, 23 Jul 2015 14:46:49 -0700 Message-ID: Subject: Re: Dealing with the NMI mess To: Willy Tarreau Cc: Steven Rostedt , Linus Torvalds , X86 ML , "linux-kernel@vger.kernel.org" , Borislav Petkov , Thomas Gleixner , Peter Zijlstra , Brian Gerst Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1704 Lines: 38 On Thu, Jul 23, 2015 at 2:46 PM, Willy Tarreau wrote: > On Thu, Jul 23, 2015 at 05:31:05PM -0400, Steven Rostedt wrote: >> On Thu, 23 Jul 2015 14:08:59 -0700 >> Linus Torvalds wrote: >> >> > On Thu, Jul 23, 2015 at 1:49 PM, Andy Lutomirski wrote: >> > > >> > > Issue A: to return with RF clear, we need to disarm the breakpoint. >> > > If it's limited to the duration of the NMI, that's easy. If not, when >> > > do we re-arm? New prepare_exit_to_usermode hook? Hmm, setting ti >> > > flags during context switch may target the wrong task. >> > >> > We don't re-arm it. >> > >> >> Let me get this straight. The idea is in the #DB handler to detect that >> it was triggered in NMI context, and if so, simply disarm that >> breakpoint permanently, right? >> >> Nothing should be adding hw breakpoints to NMI code anyway. Sounds >> perfectly reasonable to me. Of course, how we tell we are in NMI >> brings back all the races as we had in the nesting code. We can check >> the per-cpu variable that is set with nmi_enter() and cleared at >> nmi_exit() but what happens if the breakpoint is outside those calls. >> We can check the stack pointer, but then we are back to userspace >> fooling us. Maybe add the DF trick again? > > Can't the back link of the TSS tell us where we come from ? At least > it should not be manipulable from user-space. Not on 64-bit -- there are no tasks :) --Andy -- 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/