From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6411CC11D2F for ; Mon, 24 Feb 2020 16:27:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 416FE20836 for ; Mon, 24 Feb 2020 16:27:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727795AbgBXQ1M (ORCPT ); Mon, 24 Feb 2020 11:27:12 -0500 Received: from mail.kernel.org ([198.145.29.99]:37454 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727160AbgBXQ1L (ORCPT ); Mon, 24 Feb 2020 11:27:11 -0500 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AD3372080D; Mon, 24 Feb 2020 16:27:09 +0000 (UTC) Date: Mon, 24 Feb 2020 11:27:08 -0500 From: Steven Rostedt To: Peter Zijlstra Cc: Andy Lutomirski , LKML , linux-arch , Ingo Molnar , Joel Fernandes , Greg KH , gustavo@embeddedor.com, Thomas Gleixner , paulmck@kernel.org, Josh Triplett , Mathieu Desnoyers , Lai Jiangshan , Tony Luck , Frederic Weisbecker , Dan Carpenter , Masami Hiramatsu Subject: Re: [PATCH v4 05/27] x86: Replace ist_enter() with nmi_enter() Message-ID: <20200224112708.4f307ba3@gandalf.local.home> In-Reply-To: <20200224104346.GJ14946@hirez.programming.kicks-ass.net> References: <20200221133416.777099322@infradead.org> <20200221134215.328642621@infradead.org> <20200221202246.GA14897@hirez.programming.kicks-ass.net> <20200224104346.GJ14946@hirez.programming.kicks-ass.net> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 24 Feb 2020 11:43:46 +0100 Peter Zijlstra wrote: > -dotraplinkage void notrace do_int3(struct pt_regs *regs, long error_code) > +dotraplinkage notrace void do_int3(struct pt_regs *regs, long error_code) > { > if (poke_int3_handler(regs)) > return; > > /* > - * Use ist_enter despite the fact that we don't use an IST stack. > - * We can be called from a kprobe in non-CONTEXT_KERNEL kernel > - * mode or even during context tracking state changes. > - * > - * This means that we can't schedule. That's okay. > + * Unlike any other non-IST entry, we can be called from pretty much > + * any location in the kernel through kprobes -- text_poke() will most > + * likely be handled by poke_int3_handler() above. This means this > + * handler is effectively NMI-like. > */ > - ist_enter(regs); > + nmi_enter(); Hmm, note that nmi_enter() calls other functions. Did you make sure all of them are not able to be kprobed. This is different than just being "NMI like", it's that if they are kprobed, then this will go into an infinite loop because nothing can have a kprobe before the kprobe int3 handler is called here. -- Steve > RCU_LOCKDEP_WARN(!rcu_is_watching(), "entry code didn't wake RCU"); > #ifdef CONFIG_KGDB_LOW_LEVEL_TRAP > if (kgdb_ll_trap(DIE_INT3, "int3", regs, error_code, X86_TRAP_BP, > @@ -563,7 +530,7 @@ dotraplinkage void notrace do_int3(struc > cond_local_irq_disable(regs); > > exit: > - ist_exit(regs); > + nmi_exit(); > } > NOKPROBE_SYMBOL(do_int3);