public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
To: Frederic Weisbecker <fweisbec@gmail.com>,
	Jovi Zhang <bookjovi@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Ingo Molnar <mingo@redhat.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: uprobe: checking probe event include directory
Date: Tue, 17 Jul 2012 22:57:36 +0530	[thread overview]
Message-ID: <20120717172736.GA6854@linux.vnet.ibm.com> (raw)
In-Reply-To: <20120717105936.GC28744@somewhere>

* Frederic Weisbecker <fweisbec@gmail.com> [2012-07-17 12:59:39]:

> On Tue, Jul 17, 2012 at 06:12:28PM +0800, Jovi Zhang wrote:
> > From 16ed13ee9098ae01705e8456005d1ad6d9909128 Mon Sep 17 00:00:00 2001
> > From: Jovi Zhang <bookjovi@gmail.com>
> > Date: Wed, 18 Jul 2012 01:16:23 +0800
> > Subject: [PATCH] uprobe: checking probe event include directory
> > 
> > Currently below command run successful:
> > $ echo 'p /bin:0x4245c0' > /sys/kernel/debug/tracing/uprobe_events

good catch.

> > 
> > this don't make sense, because /bin is a directory,
> > so make this checking earily, not report error untill probe enable.
> > 
> > Signed-off-by: Jovi Zhang <bookjovi@gmail.com>
> 
> Adding Srikar in Cc.
> 
> > ---
> >  kernel/trace/trace_uprobe.c |    5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
> > index 85158fa..cf382de 100644
> > --- a/kernel/trace/trace_uprobe.c
> > +++ b/kernel/trace/trace_uprobe.c
> > @@ -259,6 +259,11 @@ static int create_trace_uprobe(int argc, char **argv)
> >  		goto fail_address_parse;
> > 
> >  	inode = igrab(path.dentry->d_inode);
> > +	 if (S_ISDIR(inode->i_mode)) {

How about checking for regular files but not directory.
i.e it should avoid tracing special files 

Something like: 

	if (!S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)) {

> > +		ret = -EINVAL;
> > +		pr_info("probe file cannot be directory.\n");

we could drop the pr_info line here, since we would any print we
failed to parse the address.

Probably you could change the last pr_info from 

pr_info("Failed to parse address.\n");

to 

pr_info("Failed to parse address or file.\n");


-- 
Thanks and Regards
Srikar
> > +		goto fail_address_parse;
> > +	}
> > 
> >  	argc -= 2;
> >  	argv += 2;
> > -- 
> > 1.7.9.7
> 


  reply	other threads:[~2012-07-17 17:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-17 10:12 uprobe: checking probe event include directory Jovi Zhang
2012-07-17 10:59 ` Frederic Weisbecker
2012-07-17 17:27   ` Srikar Dronamraju [this message]
2012-07-18  2:36     ` Jovi Zhang
     [not found]       ` <20120718110731.GE5006@linux.vnet.ibm.com>
2012-07-18 11:38         ` [offlist] " Jovi Zhang
2012-07-18 11:45           ` Srikar Dronamraju
2012-10-12  0:20             ` Jovi Zhang
2012-11-19  9:40           ` Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120717172736.GA6854@linux.vnet.ibm.com \
    --to=srikar@linux.vnet.ibm.com \
    --cc=bookjovi@gmail.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox