From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11068 invoked by alias); 11 Dec 2013 13:34:38 -0000 Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org Received: (qmail 11057 invoked by uid 89); 11 Dec 2013 13:34:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,FSL_HELO_FAKE,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-ee0-f50.google.com Received: from Unknown (HELO mail-ee0-f50.google.com) (74.125.83.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 11 Dec 2013 13:34:36 +0000 Received: by mail-ee0-f50.google.com with SMTP id c41so2871665eek.23 for ; Wed, 11 Dec 2013 05:34:27 -0800 (PST) X-Received: by 10.14.211.69 with SMTP id v45mr1776100eeo.75.1386768866865; Wed, 11 Dec 2013 05:34:26 -0800 (PST) Received: from gmail.com (BC24D856.catv.pool.telekom.hu. [188.36.216.86]) by mx.google.com with ESMTPSA id v1sm53624793eef.9.2013.12.11.05.34.25 for (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Dec 2013 05:34:26 -0800 (PST) Date: Wed, 11 Dec 2013 13:34:00 -0000 From: Ingo Molnar To: Masami Hiramatsu Cc: Ananth N Mavinakayanahalli , Sandeepa Prabhu , x86@kernel.org, lkml , "Steven Rostedt (Red Hat)" , systemtap@sourceware.org, "David S. Miller" Subject: Re: [PATCH -tip v4 0/6] kprobes: introduce NOKPROBE_SYMBOL() and fixes crash bugs Message-ID: <20131211133423.GB3101@gmail.com> References: <20131204012841.22118.82992.stgit@kbuild-fedora.novalocal> <20131204084551.GA31772@gmail.com> <529FBA71.6070107@hitachi.com> <20131205102127.GA19923@gmail.com> <52A137B6.6030307@hitachi.com> <20131210152811.GA1195@gmail.com> <52A7CA0A.9060009@hitachi.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <52A7CA0A.9060009@hitachi.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2013-q4/txt/msg00389.txt.bz2 * Masami Hiramatsu wrote: > > So why are annotations needed at all? What can happen if an > > annotation is missing and a piece of code is probed which is also > > used by the kprobes code internally - do we crash, lock up, > > misbehave or handle it safely? > > The kprobe has recursion detector, [...] It's the 'current_kprobe' percpu variable, checked via kprobe_running(), right? > [...] but it is detected in the kprobe exception(int3) handler, this > means that if we put a probe before detecting the recursion, we'll > do an infinite recursion. So only the (presumably rather narrow) code path leading to the recursion detection code has to be annotated, correct? > And also, even if we can detect the recursion, we can't stop the > kernel, we need to skip the probe. This means that we need to > recover to the main execution path by doing single step. As you may > know, since the single stepping involves the debug exception, we > have to avoid proving on that path too. Or we'll have an infinite > recursion again. I don't see why this is needed: if a "probing is disabled" recursion flag is set the moment the first probe fires, and if it's only cleared once all processing is finished, then any intermediate probes should simply return early from int3 and not fire. What am I missing? Thanks, Ingo