Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp720595pxb; Tue, 2 Feb 2021 16:39:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJzd8QBYFgP0IQZsxOIXH4aVnzjOFSJgYmM4dlRSfltSrt2meT4OOMauZ5Q1ytNYhBKJosWC X-Received: by 2002:a17:906:1c4b:: with SMTP id l11mr585407ejg.155.1612312750524; Tue, 02 Feb 2021 16:39:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612312750; cv=none; d=google.com; s=arc-20160816; b=L3yylbthAnhgSaHslUF1DsbLekt1pO9HQwp+KvgmH9w+aso+3r5bLP+jPg7k9iJiAY 7E0y888gskQ1D/d61m37XHSxOP5ZTMULSUdKKWo8dk91F5dYXioF/yk9jmbi8sIVwxf8 0kdMa0S7VjHkygeLn7Tt70sXgXwXvOaiFv/bCXNOmrsnn30UwD7zw635nkwMYAmnIHSY RD8pNBVdaBYlrUAS0yP0OBv2m9Wws7lrN4JaelqnDDcDjyVUNyXhYpn4I6tGBYIw2sO+ ZJfpfOUizNVljb0o/9W/1OVAw05yOVY648WFL82BYo3CWTwbP+VkSV1gFP/xq1d2W7dW GnvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=jFGMt/5rvZkOd4kJq4sdHZEiD2PN74Dx0ZAKwhJWvEU=; b=AfmePMW3tcwXFaZy2UfaXsWmYuwdziT6BYcB5uX3d4IekKTRiuUjDdg6XHzi8nUT5x W24Jofku15hA7dRDoJwEWLDap0kkZ7Kvkw1i57uV3PAp790Qhq+rd2tPnfdUcqNq/3iE O84haxdy7CScJ4XjcLn7v3PL4KoeDjZIHhK4ZFhlIoDOLOAHuklyZ6O78TM5Wnie8jSQ qi+3WzUEB5N/gVVy7mhlKE2FZhy8ALLEeJCggjIrJYH5UT9zZgi7n/agFnMMzBxkYToa f8G84kVkc+mMXl50KvJLpbrArWmH1H5eFFjRWQOhOuU14YQ64gBCEwKnb7QI371UYPyX 9xVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=Z8xIBS0F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a10si221217edv.164.2021.02.02.16.38.45; Tue, 02 Feb 2021 16:39:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=Z8xIBS0F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238555AbhBBSdH (ORCPT + 99 others); Tue, 2 Feb 2021 13:33:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238694AbhBBSb1 (ORCPT ); Tue, 2 Feb 2021 13:31:27 -0500 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD578C0613ED; Tue, 2 Feb 2021 10:30:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=jFGMt/5rvZkOd4kJq4sdHZEiD2PN74Dx0ZAKwhJWvEU=; b=Z8xIBS0FsqnMJFgEQ0eLvw3f8X FbBGHTxQZbnZJrLRO4VjHEGfCgyvYi9mAHy4FevWoNdz7dJgitQSZCQElU764JLE/WqyQyheXR8c6 0rwEMVSUmUkmcpsdn/mOP57DbkvC4QlSAVNcMO7R5HV+9Matczizc6cXxbC9lY8a9NwCA14YrKkh1 dqvYW81Uliy8NnctdU9RuX1l69nlG10l3zmDHDY3hDBxr5zu8BWhhGgr9NdmYdPvtu6GUcwVY9B0s U6S2W6AmcrZbJKwDlbsybn82CKW5LFxegyALTemTNwKbZc0qDMcCtVfFIhdNShbjSCTVsQstRAAPC 2LPa6Xtw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1l70Rg-0005bW-3A; Tue, 02 Feb 2021 18:30:36 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 8950D301179; Tue, 2 Feb 2021 19:30:34 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 73BBE203B8CC7; Tue, 2 Feb 2021 19:30:34 +0100 (CET) Date: Tue, 2 Feb 2021 19:30:34 +0100 From: Peter Zijlstra To: Steven Rostedt Cc: Alexei Starovoitov , Masami Hiramatsu , Nikolay Borisov , LKML , Alexei Starovoitov , bpf , Josh Poimboeuf Subject: Re: kprobes broken since 0d00449c7a28 ("x86: Replace ist_enter() with nmi_enter()") Message-ID: References: <20210129175943.GH8912@worktop.programming.kicks-ass.net> <20210129140103.3ce971b7@gandalf.local.home> <20210129162454.293523c6@gandalf.local.home> <20210130074410.6384c2e2@oasis.local.home> <20210202095249.5abd6780@gandalf.local.home> <20210202115623.08e8164d@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210202115623.08e8164d@gandalf.local.home> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 02, 2021 at 11:56:23AM -0500, Steven Rostedt wrote: > NMIs are special, and they always have been. They shouldn't be doing much > anyway. If they are, then that's a problem. There is a fair amount of NMI level code these days, and it seems to be ever increasing... > My question wasn't to have them do it, I was simply asking if they do. I > was assuming that they do not. per nmi_enter() we do: __preempt_count_add(NMI_OFFSET + HARDIRQ_OFFSET); \ > > But it doesn't help with: > > > > spin_lock_irq(&foo); // task context > > #DB > > spin_lock_irq(&foo); // interrupt context per your above > > The statement above said: > > "If #DB and #BP do not change the in_interrupt() context" > > Which would make the above be in the same context and the handler would > not be called for the #DB case. But then replace the above #DB with __fentry__ and explain how it is fundamentally different? And consider that direct call into god knows what code option you have. That doesn't go past any recursion checks IIRC. > I'm fine with #DB and #BP being a "in_nmi()", as they are probably even > more special than NMIs. That does mean that kprobes are then fundamentally running from in_nmi(), which is what started all this. Sure, the opt-probes and ftrace-probes don't actually have in_nmi() set today (because they don't trigger an exception), but given that that is all optional, any kprobe handler had better be in_nmi() clean.