[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANiYik6aYAEB74qrkL_3Sq_tk7crKsYW5xa-Qxe7pGJB2fLRxw@mail.gmail.com>
Date: Mon, 1 Jul 2013 19:21:14 -0700
From: Alexander Lam <azl@...gle.com>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: linux-kernel@...r.kernel.org, David Sharp <dhsharp@...gle.com>,
Vaibhav Nagarnaik <vnagarnaik@...gle.com>,
Alexander Z Lam <lambchop468@...il.com>
Subject: Re: [PATCH 3/3] tracing: Protect ftrace_trace_arrays list in trace_events.c
Oh, sorry, that is an incomplete patch; some bits are in a patch I
dropped. I'll send you a new one in about 20 minutes.
- Alex
On Mon, Jul 1, 2013 at 6:25 PM, Steven Rostedt <rostedt@...dmis.org> wrote:
> On Mon, 2013-07-01 at 15:31 -0700, Alexander Z Lam wrote:
>> There are multiple places where the ftrace_trace_arrays list is accessed in
>> trace_events.c without the trace_types_lock held.
>
> Hmm, doesn't compile. Not a complete patch? trace_types_lock is local to
> trace.c, and needs to be in trace.h and non static.
>
> -- Steve
>
>>
>> Cc: David Sharp <dhsharp@...gle.com>
>> Cc: Alexander Z Lam <lambchop468@...il.com>
>> Signed-off-by: Alexander Z Lam <azl@...gle.com>
>> ---
>> kernel/trace/trace_events.c | 9 ++++++++-
>> 1 file changed, 8 insertions(+), 1 deletion(-)
>>
>> diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
>> index 6db3290..26351cc 100644
>> --- a/kernel/trace/trace_events.c
>> +++ b/kernel/trace/trace_events.c
>> @@ -1586,6 +1586,7 @@ static void __add_event_to_tracers(struct ftrace_event_call *call,
>> int trace_add_event_call(struct ftrace_event_call *call)
>> {
>> int ret;
>> + mutex_lock(&trace_types_lock);
>> mutex_lock(&event_mutex);
>>
>> ret = __register_event(call, NULL);
>> @@ -1593,11 +1594,13 @@ int trace_add_event_call(struct ftrace_event_call *call)
>> __add_event_to_tracers(call, NULL);
>>
>> mutex_unlock(&event_mutex);
>> + mutex_unlock(&trace_types_lock);
>> return ret;
>> }
>>
>> /*
>> - * Must be called under locking both of event_mutex and trace_event_sem.
>> + * Must be called under locking of trace_types_lock, event_mutex and
>> + * trace_event_sem.
>> */
>> static void __trace_remove_event_call(struct ftrace_event_call *call)
>> {
>> @@ -1609,11 +1612,13 @@ static void __trace_remove_event_call(struct ftrace_event_call *call)
>> /* Remove an event_call */
>> void trace_remove_event_call(struct ftrace_event_call *call)
>> {
>> + mutex_lock(&trace_types_lock);
>> mutex_lock(&event_mutex);
>> down_write(&trace_event_sem);
>> __trace_remove_event_call(call);
>> up_write(&trace_event_sem);
>> mutex_unlock(&event_mutex);
>> + mutex_unlock(&trace_types_lock);
>> }
>>
>> #define for_each_event(event, start, end) \
>> @@ -1757,6 +1762,7 @@ static int trace_module_notify(struct notifier_block *self,
>> {
>> struct module *mod = data;
>>
>> + mutex_lock(&trace_types_lock);
>> mutex_lock(&event_mutex);
>> switch (val) {
>> case MODULE_STATE_COMING:
>> @@ -1767,6 +1773,7 @@ static int trace_module_notify(struct notifier_block *self,
>> break;
>> }
>> mutex_unlock(&event_mutex);
>> + mutex_unlock(&trace_types_lock);
>>
>> return 0;
>> }
>
>
--
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