From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754790Ab3AGN72 (ORCPT ); Mon, 7 Jan 2013 08:59:28 -0500 Received: from hrndva-omtalb.mail.rr.com ([71.74.56.122]:26443 "EHLO hrndva-omtalb.mail.rr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754505Ab3AGN70 (ORCPT ); Mon, 7 Jan 2013 08:59:26 -0500 X-Authority-Analysis: v=2.0 cv=O9a7TWBW c=1 sm=0 a=rXTBtCOcEpjy1lPqhTCpEQ==:17 a=mNMOxpOpBa8A:10 a=DpZN2MZ322sA:10 a=5SG0PmZfjMsA:10 a=Q9fys5e9bTEA:10 a=meVymXHHAAAA:8 a=0QnN7xjQLoUA:10 a=pGLkceISAAAA:8 a=VnNF1IyMAAAA:8 a=n1X3vdIT7vWwZHCaPpoA:9 a=PUjeQqilurYA:10 a=MSl-tDqOz04A:10 a=jeBq3FmKZ4MA:10 a=OYghQVagt972CARU:21 a=L-3r89mo3KU2ZB84:21 a=rXTBtCOcEpjy1lPqhTCpEQ==:117 X-Cloudmark-Score: 0 X-Authenticated-User: X-Originating-IP: 74.67.115.198 Message-ID: <1357567165.10284.85.camel@gandalf.local.home> Subject: Re: [PATCH 3/3] tracing: Verify target file before registering a uprobe event From: Steven Rostedt To: Namhyung Kim Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Andrew Morton , Jovi Zhang , Srikar Dronamraju Date: Mon, 07 Jan 2013 08:59:25 -0500 In-Reply-To: <87vcbdr2nq.fsf@sejong.aot.lge.com> References: <20130102225035.140076434@goodmis.org> <20130103004212.690763002@goodmis.org> <87vcbdr2nq.fsf@sejong.aot.lge.com> Content-Type: text/plain; charset="ISO-8859-15" X-Mailer: Evolution 3.4.4-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2013-01-04 at 13:30 +0900, Namhyung Kim wrote: > Hi, Steve. > > On Wed, 02 Jan 2013 17:50:38 -0500, Steven Rostedt wrote: > > From: Jovi Zhang > > > > Without this patch, we can register a uprobe event for a directory. > > Enabling such a uprobe event would fail anyway . > > > > Example: > > $ echo 'p /bin:0x4245c0' > /sys/kernel/debug/tracing/uprobe_events > > > > However dirctories cannot be valid targets for uprobe. > > Hence verify if the target is a regular file during the probe > > registration. > > > > Signed-off-by: Jovi Zhang > > Acked-by: Srikar Dronamraju > > Signed-off-by: Steven Rostedt > > --- > > kernel/trace/trace_uprobe.c | 6 +++++- > > 1 file changed, 5 insertions(+), 1 deletion(-) > > > > diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c > > index 03003cd..0815f25 100644 > > --- a/kernel/trace/trace_uprobe.c > > +++ b/kernel/trace/trace_uprobe.c > > @@ -257,6 +257,10 @@ static int create_trace_uprobe(int argc, char **argv) > > goto fail_address_parse; > > > > inode = igrab(path.dentry->d_inode); > > + if (!S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)) { > > Doesn't !S_ISREG() include S_ISDIR() case too? You're correct. Although I'm sure gcc should be smart enough to optimize that out. > > Anyway I can see an additional whitespace in front of the "if". Yep, I forgot to run checkpatch on this. OK, this bug isn't that big of a deal, so I'll take this patch out and put it into the 3.9 queue. Thanks, -- Steve > > Thanks, > Namhyung > > > > + ret = -EINVAL; > > + goto fail_address_parse; > > + } > > > > argc -= 2; > > argv += 2; > > @@ -356,7 +360,7 @@ fail_address_parse: > > if (inode) > > iput(inode); > > > > - pr_info("Failed to parse address.\n"); > > + pr_info("Failed to parse address or file.\n"); > > > > return ret; > > }