All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: "K.Prasad" <prasad@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [Patch 2/3] ksym_tracer: Allow bulk removal using empty or wildcard string input
Date: Mon, 22 Jun 2009 09:31:46 +0200	[thread overview]
Message-ID: <20090622073144.GA6015@nowhere> (raw)
In-Reply-To: <20090620133752.GA20214@in.ibm.com>

On Sat, Jun 20, 2009 at 07:07:52PM +0530, K.Prasad wrote:
> On Sat, Jun 20, 2009 at 01:16:41AM +0200, Frederic Weisbecker wrote:
> > On Fri, Jun 19, 2009 at 10:55:12PM +0530, K.Prasad wrote:
> > > Accept an empty string or wildcard input (of the form *:---) as input for
> > > ksym_trace_filter to perform bulk removal of all monitored entries.
> > >
> > > Signed-off-by: K.Prasad <prasad@linux.vnet.ibm.com>
> > > ---
> > >  kernel/trace/trace_ksym.c |   75 +++++++++++++++++++++++++---------------------
> > >  1 file changed, 42 insertions(+), 33 deletions(-)
> > > 
> <snipped>
> > >  /*
> > >   * There can be several possible malformed requests and we attempt to capture
> > >   * all of them. We enumerate some of the rules
> > > @@ -163,7 +191,7 @@ static int parse_ksym_trace_str(char *in
> > >  	/* Check for malformed request: (2), (1) and (5) */
> > >  	if ((!input_string) ||
> > >  		(strlen(input_string) != (KSYM_TRACER_OP_LEN + 1)) ||
> > > -			(*addr == 0))
> > > +			((*addr == 0) && strncmp(*ksymname, "*", strlen("*"))))
> > 
> > 
> > I guess you can just use strcmp() here, no? As in other use
> > of this same strncmp() in this patch.
> > 
> 
> I see both functions being used in the kernel at random (what happened
> to all the buffer-overflow scare?)! Isn't an strncmp() preferred over
> the plain strcmp() (atleast it cannot be the other way round)?


I guess it depends if the string has complicated origins :)
But a plain 1 for the len would be sufficient.
Or here you can just check **ksymname != '*'

Anyway, I'm arguing about neat things that don't matter that much.

Thanks.
 
> > > @@ -251,9 +280,11 @@ static ssize_t ksym_trace_filter_write(s
> > >  	unsigned long ksym_addr = 0;
> > >  	int ret, op, changed = 0;
> > >  
> > > -	/* Ignore echo "" > ksym_trace_filter */
> > > -	if (count == 0)
> > > -		return 0;
> > > +	/* Clear all breakpoint requests if echo "" > ksym_trace_filter */
> > > +	if (count == 1) {
> > > +		ksym_trace_reset(NULL);
> > > +		return count;
> > > +	}
> > 
> > 
> > And then if I do:
> > 
> > echo -n 1 > ksym_trace_filter
> > 
> > That would also clean these breakpoints?
> > 
> > Frederic.
> >
> 
> No, I did not think about this scenario and I am changing the patch to
> handle such a case. Also, the value of 'count' cannot be '0' as such
> inputs are ignored (e.g. echo -n "" > ksym_trace_filter is simply
> ignored) and so I'm removing the check for the same.
> 
> Please find a new version of the patch sent here:
> http://lkml.org/lkml/2009/6/20/73.
> 
> Thanks,
> K.Prasad
> 
>  


  reply	other threads:[~2009-06-22  7:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20090619172035.443923337@prasadkr_t60p.in.ibm.com>
2009-06-19 17:24 ` [Patch 1/3] ksym_tracer: Eliminate trace concatenation and machine stall issues post removal K.Prasad
2009-06-19 23:03   ` Frederic Weisbecker
2009-06-20  3:57     ` K.Prasad
2009-06-23 14:10       ` Frederic Weisbecker
2009-06-19 17:25 ` [Patch 2/3] ksym_tracer: Allow bulk removal using empty or wildcard string input K.Prasad
2009-06-19 23:16   ` Frederic Weisbecker
2009-06-20 13:37     ` K.Prasad
2009-06-22  7:31       ` Frederic Weisbecker [this message]
2009-06-20 13:35   ` [Patch 2/3] ksym_tracer: Allow bulk removal using empty or wildcard string input - ver II K.Prasad
2009-06-23 14:30     ` Frederic Weisbecker
2009-06-19 17:25 ` [Patch 3/3] ksym_tracer: Documentation containing usage guide for ksym tracer K.Prasad
2009-06-19 23:24   ` Frederic Weisbecker

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=20090622073144.GA6015@nowhere \
    --to=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=prasad@linux.vnet.ibm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.