All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] tracing: Simplify trace_array_get()
Date: Fri, 19 Jul 2013 19:20:53 +0200	[thread overview]
Message-ID: <20130719172053.GA4845@redhat.com> (raw)
In-Reply-To: <20130719163312.GA21544@redhat.com>

On 07/19, Oleg Nesterov wrote:
>
> On 07/19, Steven Rostedt wrote:
> >
> > On Fri, 2013-07-19 at 17:51 +0200, Oleg Nesterov wrote:
> > >  	mutex_lock(&trace_types_lock);
> > > -	list_for_each_entry(tr, &ftrace_trace_arrays, list) {
> > > -		if (tr == this_tr) {
> > > -			tr->ref++;
> > > -			ret = 0;
> > > -			break;
> > > -		}
> > > +	if (!list_empty(&this_tr->list)) {
> >
> > Because this_tr can be freed outside the lock. Accessing this_tr->list
> > can cause a crash.
>
> Aaah, indeed.
>
> Thanks Steven!

Yes. But unless I missed something again this logic doesn't look exactly
correct. Because it seems that trace_array_get() can succeed when it
shoudn't.

trace_array_get() can race with instance_delete() + new_instance_create(),
and _create()->kzalloc() can return the same memory which was freed by
_delete().

No?

Oleg.


  reply	other threads:[~2013-07-19 17:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-19 15:50 [PATCH 0/1] tracing: Simplify trace_array_get() Oleg Nesterov
2013-07-19 15:51 ` [PATCH 1/1] " Oleg Nesterov
2013-07-19 16:26   ` Steven Rostedt
2013-07-19 16:33     ` Oleg Nesterov
2013-07-19 17:20       ` Oleg Nesterov [this message]
2013-07-19 17:35         ` Steven Rostedt
2013-07-19 17:39           ` Steven Rostedt
2013-07-19 18:24           ` Oleg Nesterov
2013-07-21 19:14             ` Oleg Nesterov

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=20130719172053.GA4845@redhat.com \
    --to=oleg@redhat.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --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 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.