From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751854AbdGGKtv (ORCPT ); Fri, 7 Jul 2017 06:49:51 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:34666 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750768AbdGGKtt (ORCPT ); Fri, 7 Jul 2017 06:49:49 -0400 Date: Fri, 7 Jul 2017 12:49:45 +0200 From: Ingo Molnar To: Masami Hiramatsu Cc: "Naveen N. Rao" , Ananth N Mavinakayanahalli , linux-kernel@vger.kernel.org Subject: Re: [PATCH] jprobes: Ensure that the probepoint is at function entry Message-ID: <20170707104945.zk4boiztopc5fisf@gmail.com> References: <20170629145655.5282-1-naveen.n.rao@linux.vnet.ibm.com> <20170705104216.674ejyueqquctsn5@gmail.com> <20170706190323.8892576e53af1be29f6cf8f4@kernel.org> <20170706121549.iqwcqh6xg4cyli5p@gmail.com> <20170707100224.f69452def8aa8f8807f90410@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170707100224.f69452def8aa8f8807f90410@kernel.org> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Masami Hiramatsu wrote: > On Thu, 6 Jul 2017 14:15:49 +0200 > Ingo Molnar wrote: > > > * Masami Hiramatsu wrote: > > > > > > Also, 'function_offset_within_entry' is way too long a name, and it's also a > > > > minomer I think. The purpose of this function is to enforce that the relative > > > > 'offset' of a new probe is at the standard function entry offset: i.e. 0 on most > > > > architectures, and some ABI dependent constant on PowerPC, right? > > > > > > > > That's not at all clear from that name, plus it's a global namespace symbol, yet > > > > has no 'kprobes' prefix. So it should be named something like > > > > 'kprobe_offset_valid()' or such, with an arch_kprobe_offset_valid() counterpart. > > > > > > Hmm, I would rather like kprobe_within_entry(), since offset != 0 is > > > actually valid for normal kprobe, that is kretprobe and jprobe limitation. > > > > But what entry? That it's within a range or that offset is always 0 is really an > > implementational detail: depending on what type of kprobe it is, it is either > > validly within the confines of the specified function symbol or not. > > Hmm, right. In most cases, it just checks the address (symbol+offset) is > on the function entry. > > > What _really_ matters to callers is whether it's a valid kprobe to be inserted > > into that function, right? > > No, for that purpose, kprobes checks it in other places (kprobe_addr() and check_kprobe_address_safe()). This function is an additional safety check > only for kretprobe and jprobe which must be placed on the function entry. > (kprobe can probe function body but kretprobe and jprobes are not) > > > I.e. the long name came from over-specifying what is done by the function - while > > simplifying makes it actually more meaningful to read. > > I see, but kprobe_offset_valid is too simple. How about kprobe_on_func_entry()? Ok, kprobe_on_func_entry() works for me. Thanks, Ingo