[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20130625172359.GA8523@redhat.com>
Date: Tue, 25 Jun 2013 19:23:59 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: "zhangwei(Jovi)" <jovi.zhangwei@...wei.com>
Cc: Steven Rostedt <rostedt@...dmis.org>,
Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>,
Srikar Dronamraju <srikar@...ux.vnet.ibm.com>,
Frederic Weisbecker <fweisbec@...il.com>,
Ingo Molnar <mingo@...hat.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] tracing/uprobes: disallow unregister trace_uprobe
when trace_uprobe is in use
On 06/25, zhangwei(Jovi) wrote:
>
> We cannot unregister trace_uprobe when trace_uprobe is in use,
> otherwise resource will leak.
>
> Just return -EBUSY if user want to unregister a trace_uprobe
> which in use.
Hmm. Afaics, this is not that simple. This patch copies the similar
logic from trace_kprobe.c. I'll recheck later but so far I strongly
believe that code is wrong.
So please forget about trace_uprobe.c for the moment. Let's look at
release_all_trace_probes().
It checks trace_probe_is_enabled(), but how can we trust this check?
We can race with enable_trace_probe() which is going to set
TP_FLAG_TRACE/TP_FLAG_PROFILE.
And no, we can't change enable_trace_probe() to take probe_lock,
this can ABBA with unregister_trace_probe() called under this lock
because of trace_remove_event_call() which takes event_mutex.
At the same time, the fact that trace_remove_event_call() takes
event_mutex can probably help, because __trace_remove_event_call()
should do TRACE_REG_UNREGISTER and this should serialize us with
TRACE_REG_REGISTER.
But TRACE_REG_PERF_REGISTER is different, and does not look safe.
In fact I suspect there are more serious problems, but I need to
recheck.
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