Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752331AbbG3Pl2 (ORCPT ); Thu, 30 Jul 2015 11:41:28 -0400 Received: from mail-wi0-f195.google.com ([209.85.212.195]:35071 "EHLO mail-wi0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750937AbbG3Pl1 (ORCPT ); Thu, 30 Jul 2015 11:41:27 -0400 Subject: Re: Dealing with the NMI mess To: Andy Lutomirski , Peter Zijlstra References: <20150724090342.6d11e16d@gandalf.local.home> <20150724132128.GA3612@1wt.eu> <20150724103127.3c3f4693@gandalf.local.home> <20150724145901.GB3612@1wt.eu> <20150724111621.34713023@gandalf.local.home> <20150724152637.GC3612@1wt.eu> <20150724153054.GK19282@twins.programming.kicks-ass.net> <20150724195509.GM2859@worktop.programming.kicks-ass.net> <20150724205119.GM19282@twins.programming.kicks-ass.net> Cc: Linus Torvalds , Willy Tarreau , Steven Rostedt , X86 ML , "linux-kernel@vger.kernel.org" , Borislav Petkov , Thomas Gleixner , Brian Gerst From: Paolo Bonzini X-Enigmail-Draft-Status: N1110 Message-ID: <55BA45A2.8050909@redhat.com> Date: Thu, 30 Jul 2015 17:41:22 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1234 Lines: 33 On 24/07/2015 23:08, Andy Lutomirski wrote: > user_icebp is set if int $0x01 happens, except it isn't because user > code can't actually do that -- it'll cause #GP instead. > > user_icebp is also set if the user has a bloody in-circuit emulator, > given the name. But who on Earth has one of those on a system new > enough to run Linux and, even if they have one, why on Earth are they > using it to send SIGTRAP. You do not need either "int $0x01" or an ICE to set user_icebp = 1. You can use the 0xf1 opcode, which is kinda like 0xcc but generates #DB instead of #BP. The historical name is ICEBP because in-circuit emulators used it for software breakpoints, just like your usual debugger used 0xcc aka int3. And just like 0xcc it's unprivileged, so you can actually get a SIGTRAP with asm(".byte 0xf1"). So... > In any event, user_icebp is only set if user_mode(regs), so it's safe > locking-wise. But please let's delete it. ... it's safe, but it has some use (!). Paolo -- 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/