All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Oleg Nesterov <oleg@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Linux-mm <linux-mm@kvack.org>, Ingo Molnar <mingo@elte.hu>,
	Andi Kleen <andi@firstfloor.org>,
	Christoph Hellwig <hch@infradead.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Roland McGrath <roland@hack.frob.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
	Arnaldo Carvalho de Melo <acme@infradead.org>,
	Anton Arapov <anton@redhat.com>,
	Ananth N Mavinakayanahalli <ananth@in.ibm.com>,
	Jim Keniston <jkenisto@linux.vnet.ibm.com>,
	tulasidhard@gmail.com
Subject: Re: Fwd: uprobes: register/unregister probes.
Date: Thu, 24 Nov 2011 10:49:59 +0100	[thread overview]
Message-ID: <1322128199.2921.3.camel@twins> (raw)
In-Reply-To: <20111124070303.GB28065@linux.vnet.ibm.com>

On Thu, 2011-11-24 at 12:33 +0530, Srikar Dronamraju wrote:
> > On Fri, 2011-11-18 at 16:37 +0530, Srikar Dronamraju wrote:
> > > +int register_uprobe(struct inode *inode, loff_t offset,
> > > +                               struct uprobe_consumer *consumer)
> > > +{
> > > +       struct uprobe *uprobe;
> > > +       int ret = -EINVAL;
> > > +
> > > +       if (!consumer || consumer->next)
> > > +               return ret;
> > > +
> > > +       inode = igrab(inode);
> > 
> > So why are you dealing with !consumer but not with !inode? and why
> > does
> > it make sense to allow !consumer at all?
> > 
> 
> 
> I am not sure if I got your comment correctly.
> 
> I do check for inode just after the igrab.

No you don't, you check the return value of igrab(), but you crash hard
when someone calls register_uprobe(.inode=NULL).

> I am actually not dealing with !consumer.
> If the consumer is NULL, then we dont have any handler to run so why
> would we want to register such a probe?

Why allow someone calling register_uprobe(.consumer=NULL) to begin with?
That doesn't make any sense.

> Also if consumer->next is Non-NULL, that means that this consumer was
> already used.  Reusing the consumer, can result in consumers list getting
> broken into two.

Yeah, although at that point why be nice about it? Just but a WARN_ON()
in or so.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Peter Zijlstra <peterz@infradead.org>
To: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Oleg Nesterov <oleg@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Linux-mm <linux-mm@kvack.org>, Ingo Molnar <mingo@elte.hu>,
	Andi Kleen <andi@firstfloor.org>,
	Christoph Hellwig <hch@infradead.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Roland McGrath <roland@hack.frob.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
	Arnaldo Carvalho de Melo <acme@infradead.org>,
	Anton Arapov <anton@redhat.com>,
	Ananth N Mavinakayanahalli <ananth@in.ibm.com>,
	Jim Keniston <jkenisto@linux.vnet.ibm.com>,
	tulasidhard@gmail.com
Subject: Re: Fwd: uprobes: register/unregister probes.
Date: Thu, 24 Nov 2011 10:49:59 +0100	[thread overview]
Message-ID: <1322128199.2921.3.camel@twins> (raw)
In-Reply-To: <20111124070303.GB28065@linux.vnet.ibm.com>

On Thu, 2011-11-24 at 12:33 +0530, Srikar Dronamraju wrote:
> > On Fri, 2011-11-18 at 16:37 +0530, Srikar Dronamraju wrote:
> > > +int register_uprobe(struct inode *inode, loff_t offset,
> > > +                               struct uprobe_consumer *consumer)
> > > +{
> > > +       struct uprobe *uprobe;
> > > +       int ret = -EINVAL;
> > > +
> > > +       if (!consumer || consumer->next)
> > > +               return ret;
> > > +
> > > +       inode = igrab(inode);
> > 
> > So why are you dealing with !consumer but not with !inode? and why
> > does
> > it make sense to allow !consumer at all?
> > 
> 
> 
> I am not sure if I got your comment correctly.
> 
> I do check for inode just after the igrab.

No you don't, you check the return value of igrab(), but you crash hard
when someone calls register_uprobe(.inode=NULL).

> I am actually not dealing with !consumer.
> If the consumer is NULL, then we dont have any handler to run so why
> would we want to register such a probe?

Why allow someone calling register_uprobe(.consumer=NULL) to begin with?
That doesn't make any sense.

> Also if consumer->next is Non-NULL, that means that this consumer was
> already used.  Reusing the consumer, can result in consumers list getting
> broken into two.

Yeah, although at that point why be nice about it? Just but a WARN_ON()
in or so.


  reply	other threads:[~2011-11-24  9:50 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <hYuXv-26J-3@gated-at.bofh.it>
     [not found] ` <hYuXw-26J-5@gated-at.bofh.it>
     [not found]   ` <i0o1A-7sd-9@gated-at.bofh.it>
     [not found]     ` <fe077f71-dce6-40cf-988c-cc35bf4c7ae1@o11g2000prg.googlegroups.com>
2011-11-24  6:48       ` Fwd: uprobes: register/unregister probes Srikar Dronamraju
2011-11-24  6:48         ` Srikar Dronamraju
     [not found]   ` <i0nRU-7eK-11@gated-at.bofh.it>
     [not found]     ` <603b0079-5f54-4299-9a9a-a5e237ccca73@l23g2000pro.googlegroups.com>
2011-11-24  7:03       ` Srikar Dronamraju
2011-11-24  7:03         ` Srikar Dronamraju
2011-11-24  9:49         ` Peter Zijlstra [this message]
2011-11-24  9:49           ` Peter Zijlstra
2011-11-24 14:51           ` Srikar Dronamraju
2011-11-24 14:51             ` Srikar Dronamraju
2011-11-24 16:34             ` Peter Zijlstra
2011-11-24 16:34               ` Peter Zijlstra
2011-11-24  9:49       ` Srikar Dronamraju
2011-11-24  9:49         ` Srikar Dronamraju
2011-11-24 10:00         ` Peter Zijlstra
2011-11-24 10:00           ` Peter Zijlstra

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=1322128199.2921.3.camel@twins \
    --to=peterz@infradead.org \
    --cc=acme@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=ananth@in.ibm.com \
    --cc=andi@firstfloor.org \
    --cc=anton@redhat.com \
    --cc=hch@infradead.org \
    --cc=jkenisto@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@elte.hu \
    --cc=oleg@redhat.com \
    --cc=roland@hack.frob.com \
    --cc=rostedt@goodmis.org \
    --cc=srikar@linux.vnet.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=tulasidhard@gmail.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.