public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Jaswinder Singh Rajput <jaswinder@kernel.org>
Cc: mingo@redhat.com, hpa@zytor.com, linux-kernel@vger.kernel.org,
	jaswinderrajput@gmail.com, fweisbec@gmail.com,
	rostedt@goodmis.org, tglx@linutronix.de,
	linux-tip-commits@vger.kernel.org
Subject: Re: [tip:tracing/ftrace] tracing: fix oops in tracepoint_update_probe_range()
Date: Wed, 18 Mar 2009 19:58:53 +0100	[thread overview]
Message-ID: <20090318185853.GA16286@elte.hu> (raw)
In-Reply-To: <1237398997.22438.10.camel@ht.satnam>


* Jaswinder Singh Rajput <jaswinder@kernel.org> wrote:

> On Wed, 2009-03-18 at 17:51 +0000, Jaswinder Singh Rajput wrote:
> > Commit-ID:  966a6fdf6210e3ac8ce00b61cd1107cdf97ce744
> > Gitweb:     http://git.kernel.org/tip/966a6fdf6210e3ac8ce00b61cd1107cdf97ce744
> > Author:     Jaswinder Singh Rajput <jaswinder@kernel.org>
> > AuthorDate: Wed, 18 Mar 2009 22:18:56 +0530
> > Commit:     Ingo Molnar <mingo@elte.hu>
> > CommitDate: Wed, 18 Mar 2009 18:48:43 +0100
> > 
> > tracing: fix oops in tracepoint_update_probe_range()
> > 
> > Change this crash:
> > 
> >  BUG: unable to handle kernel NULL pointer dereference at (null)
> >  IP: [<ffffffff8107d4de>] tracepoint_update_probe_range+0x1f/0x9b
> >  PGD 13d5fb067 PUD 13d688067 PMD 0
> >  Oops: 0000 [#1] SMP
> > 
> > To a more debuggable WARN_ONCE().
> > 
> > Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
> > Cc: Frederic Weisbecker <fweisbec@gmail.com>
> > Cc: Steven Rostedt <rostedt@goodmis.org>
> > LKML-Reference: <1237394936.3132.1.camel@localhost.localdomain>
> > [ moved the check outside the lock and added a WARN_ON(). ]
> > Signed-off-by: Ingo Molnar <mingo@elte.hu>
> > 
> > 
> > ---
> >  kernel/tracepoint.c |    9 +++++++--
> >  1 files changed, 7 insertions(+), 2 deletions(-)
> > 
> > diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c
> > index 7960274..dd15df9 100644
> > --- a/kernel/tracepoint.c
> > +++ b/kernel/tracepoint.c
> > @@ -272,12 +272,17 @@ static void disable_tracepoint(struct tracepoint *elem)
> >   *
> >   * Updates the probe callback corresponding to a range of tracepoints.
> >   */
> > -void tracepoint_update_probe_range(struct tracepoint *begin,
> > -	struct tracepoint *end)
> > +void
> > +tracepoint_update_probe_range(struct tracepoint *begin, struct tracepoint *end)
> >  {
> >  	struct tracepoint *iter;
> >  	struct tracepoint_entry *mark_entry;
> >  
> > +	if (!iter) {
> > +		WARN_ON_ONCE(1);
> > +		return;
> > +	}
> > +
> >  	mutex_lock(&tracepoints_mutex);
> >  	for (iter = begin; iter < end; iter++) {
> >  		mark_entry = get_tracepoint(iter->name);
> 
> my original patch was correct.

It might have worked but it was rather ugly: it took the 
tracepoints_mutex for no reason.

The clean fix to skip zero-sized sections early in the function, 
without taking any lock, and without emitting a warning.

	Ingo

  parent reply	other threads:[~2009-03-18 19:00 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-18 16:23 [oops -tip] : x86 AMD 64 Jaswinder Singh Rajput
2009-03-18 16:35 ` oops in tracepoint_update_probe_range() (was: Re: [oops -tip] : x86 AMD 64) Ingo Molnar
2009-03-18 16:41   ` Frederic Weisbecker
2009-03-18 16:48   ` Jaswinder Singh Rajput
2009-03-18 16:54     ` Ingo Molnar
2009-03-18 16:56     ` Frederic Weisbecker
2009-03-18 17:27       ` Ingo Molnar
2009-03-18 17:33         ` Frederic Weisbecker
2009-03-18 17:33     ` [tip:tracing/ftrace] tracing: fix oops in tracepoint_update_probe_range() Jaswinder Singh Rajput
2009-03-18 17:38       ` Jaswinder Singh Rajput
2009-03-18 17:52         ` Jaswinder Singh Rajput
2009-03-18 17:51     ` Jaswinder Singh Rajput
2009-03-18 17:56       ` Jaswinder Singh Rajput
2009-03-18 18:00         ` Frederic Weisbecker
2009-03-18 18:12           ` Jaswinder Singh Rajput
2009-03-18 19:35             ` Frederic Weisbecker
2009-03-18 18:58         ` Ingo Molnar [this message]
2009-03-18 19:04           ` Jaswinder Singh Rajput
2009-03-18 17:57     ` Jaswinder Singh Rajput
2009-03-18 18:57     ` [tip:tracing/ftrace] tracepoints: dont update zero-sized tracepoint sections Ingo Molnar
2009-03-19  7:18   ` oops in tracepoint_update_probe_range() Lai Jiangshan
2009-03-19  7:46     ` Ingo Molnar
2009-03-19  9:41       ` Jaswinder Singh Rajput
2009-03-19 13:22       ` Mathieu Desnoyers
2009-03-19 13:34         ` Steven Rostedt
2009-03-19 14:03           ` Mathieu Desnoyers
2009-03-19 15:50           ` Ingo Molnar
2009-03-19 16:00             ` Mathieu Desnoyers
2009-03-19 16:20               ` Steven Rostedt
2009-03-23  5:18                 ` Rusty Russell
2009-03-19 15:42         ` Jaswinder Singh Rajput

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=20090318185853.GA16286@elte.hu \
    --to=mingo@elte.hu \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jaswinder@kernel.org \
    --cc=jaswinderrajput@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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