From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>,
Andrew Morton <akpm@linux-foundation.org>,
Peter Zijlstra <peterz@infradead.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Theodore Tso <tytso@mit.edu>,
Mathieu Desnoyers <compudj@krystal.dyndns.org>,
Tom Zanussi <tzanussi@gmail.com>,
Masami Hiramatsu <mhiramat@redhat.com>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Jason Baron <jbaron@redhat.com>,
"Frank Ch. Eigler" <fche@redhat.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Steven Rostedt <srostedt@redhat.com>
Subject: [PATCH 2/7] tracing: add protection around modify trace event fields
Date: Mon, 02 Mar 2009 15:29:27 -0500 [thread overview]
Message-ID: <20090302203024.132325230@goodmis.org> (raw)
In-Reply-To: <20090302202925.364437449@goodmis.org>
[-- Attachment #1: 0002-tracing-add-protection-around-modify-trace-event-fi.patch --]
[-- Type: text/plain, Size: 1349 bytes --]
From: Steven Rostedt <srostedt@redhat.com>
The trace event objects are currently not proctected against
reentrancy. This patch adds a mutex around the modifications of
the trace event fields.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
kernel/trace/trace_events.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 1d07f80..26069fa 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -14,6 +14,8 @@
#define TRACE_SYSTEM "TRACE_SYSTEM"
+static DEFINE_MUTEX(event_mutex);
+
#define events_for_each(event) \
for (event = __start_ftrace_events; \
(unsigned long)event < (unsigned long)__stop_ftrace_events; \
@@ -104,6 +106,7 @@ static int ftrace_set_clr_event(char *buf, int set)
event = NULL;
}
+ mutex_lock(&event_mutex);
events_for_each(call) {
if (!call->name)
@@ -124,6 +127,8 @@ static int ftrace_set_clr_event(char *buf, int set)
ret = 0;
}
+ mutex_unlock(&event_mutex);
+
return ret;
}
@@ -324,7 +329,9 @@ event_enable_write(struct file *filp, const char __user *ubuf, size_t cnt,
switch (val) {
case 0:
case 1:
+ mutex_lock(&event_mutex);
ftrace_event_enable_disable(call, val);
+ mutex_unlock(&event_mutex);
break;
default:
--
1.5.6.5
--
next prev parent reply other threads:[~2009-03-02 20:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-02 20:29 [PATCH 0/7] [GIT PULL] trace event updates for tip Steven Rostedt
2009-03-02 20:29 ` [PATCH 1/7] tracing: add TRACE_FIELD_SPECIAL to record complex entries Steven Rostedt
2009-03-02 20:29 ` Steven Rostedt [this message]
2009-03-02 20:29 ` [PATCH 3/7] tracing: make trace_seq_reset global and rename to trace_seq_init Steven Rostedt
2009-03-02 20:29 ` [PATCH 4/7] tracing: add format file to describe event struct fields Steven Rostedt
2009-03-02 21:11 ` Andrew Morton
2009-03-02 20:29 ` [PATCH 5/7] tracing: add ftrace headers to event format files Steven Rostedt
2009-03-02 20:29 ` [PATCH 6/7] tracing: add trace name and id to event formats Steven Rostedt
2009-03-02 20:29 ` [PATCH 7/7] tracing: add print format to event trace format files Steven Rostedt
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=20090302203024.132325230@goodmis.org \
--to=rostedt@goodmis.org \
--cc=acme@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=compudj@krystal.dyndns.org \
--cc=fche@redhat.com \
--cc=fweisbec@gmail.com \
--cc=jbaron@redhat.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@redhat.com \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=srostedt@redhat.com \
--cc=tytso@mit.edu \
--cc=tzanussi@gmail.com \
/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
Powered by JetHome