[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130719133327.GA21278@redhat.com>
Date: Fri, 19 Jul 2013 15:33:27 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>
Cc: Steven Rostedt <rostedt@...dmis.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Frederic Weisbecker <fweisbec@...il.com>,
linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
Andrew Morton <akpm@...ux-foundation.org>,
jovi.zhangwei@...wei.com, Jiri Olsa <jolsa@...hat.com>,
Srikar Dronamraju <srikar@...ux.vnet.ibm.com>
Subject: Re: Re: [RFC PATCH V2] tracing: Check f_dentry before accessing
event_file/call in inode->i_private
On 07/19, Masami Hiramatsu wrote:
>
> (2013/07/18 23:51), Oleg Nesterov wrote:
> > It removes trace_array_get/put from tracing_open_generic_file() and
> > tracing_release_generic_file(). This assumes that "call->flags++" is
> > enough, but it is not.
>
> No, it replaces trace_array_get/put with ftrace_event_file_get/put
> which calls trace_array_get/put inside.
Ah, I didn't notice your patch adds "file->tr->ref++" into
ftrace_event_file_get...
So I was wrong in any case, thanks for correcting me.
But,
> (Just one point, previous ftrace_event_file_get has a racy point
> when it does tr->ref++, it should be fixed.)
Not sure what do you mean, but unless I missed something again this
"tr->ref++" above still looks racy. instance_delete() checks tr->ref
first, then it takes event_mutex and removes/kfrees event_files.
But this doesn't really matter even if I am right, surely this can
be fixed. My only point, imho this is more complex than necessary.
In particular,
> > IOW, I believe that either .open() should do trace_array_get(), or
> > __trace_remove_event_dirs() needs another for-each-file loop which
> > checks file->call->flags & TRACE_EVENT_FL_REF_MASK.
>
> Agreed :)
Yes ;) and this makes the ref-counting even more complex, we use
different methods to avoid the races with rmdir and event_remove().
> > The same bugs which Steven's 1/4 tries to solve ;)
>
> OK, let me confirm that, would you mean we still need 2/4 - 4/4?
Yes, yes.
Oleg.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists