From: tip-bot for Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, linux-kernel@vger.kernel.org, hpa@zytor.com,
mingo@redhat.com, mathieu.desnoyers@efficios.com,
masami.hiramatsu.pt@hitachi.com, fweisbec@gmail.com,
rostedt@goodmis.org, srikar@linux.vnet.ibm.com,
tglx@linutronix.de
Subject: [tip:perf/core] tracing/kprobe: Fix handling of C-unlike argument names
Date: Thu, 9 Sep 2010 19:44:44 GMT [thread overview]
Message-ID: <tip-da34634fd39958725310d2c30c9b4543945f968b@git.kernel.org> (raw)
In-Reply-To: <20100827113912.22882.62313.stgit@ltc236.sdl.hitachi.co.jp>
Commit-ID: da34634fd39958725310d2c30c9b4543945f968b
Gitweb: http://git.kernel.org/tip/da34634fd39958725310d2c30c9b4543945f968b
Author: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
AuthorDate: Fri, 27 Aug 2010 20:39:12 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 8 Sep 2010 11:47:19 -0300
tracing/kprobe: Fix handling of C-unlike argument names
Check the argument name whether it is invalid (not C-like symbol name). This
makes event format simple.
Reported-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
LKML-Reference: <20100827113912.22882.62313.stgit@ltc236.sdl.hitachi.co.jp>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
kernel/trace/trace_kprobe.c | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index a39251e..544301d 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -514,8 +514,8 @@ static int kprobe_dispatcher(struct kprobe *kp, struct pt_regs *regs);
static int kretprobe_dispatcher(struct kretprobe_instance *ri,
struct pt_regs *regs);
-/* Check the name is good for event/group */
-static int check_event_name(const char *name)
+/* Check the name is good for event/group/fields */
+static int is_good_name(const char *name)
{
if (!isalpha(*name) && *name != '_')
return 0;
@@ -557,7 +557,7 @@ static struct trace_probe *alloc_trace_probe(const char *group,
else
tp->rp.kp.pre_handler = kprobe_dispatcher;
- if (!event || !check_event_name(event)) {
+ if (!event || !is_good_name(event)) {
ret = -EINVAL;
goto error;
}
@@ -567,7 +567,7 @@ static struct trace_probe *alloc_trace_probe(const char *group,
if (!tp->call.name)
goto error;
- if (!group || !check_event_name(group)) {
+ if (!group || !is_good_name(group)) {
ret = -EINVAL;
goto error;
}
@@ -883,7 +883,7 @@ static int create_trace_probe(int argc, char **argv)
int i, ret = 0;
int is_return = 0, is_delete = 0;
char *symbol = NULL, *event = NULL, *group = NULL;
- char *arg, *tmp;
+ char *arg;
unsigned long offset = 0;
void *addr = NULL;
char buf[MAX_EVENT_NAME_LEN];
@@ -1012,9 +1012,13 @@ static int create_trace_probe(int argc, char **argv)
ret = -ENOMEM;
goto error;
}
- tmp = strchr(tp->args[i].name, ':');
- if (tmp)
- *tmp = '_'; /* convert : to _ */
+
+ if (!is_good_name(tp->args[i].name)) {
+ pr_info("Invalid argument[%d] name: %s\n",
+ i, tp->args[i].name);
+ ret = -EINVAL;
+ goto error;
+ }
if (conflict_field_name(tp->args[i].name, tp->args, i)) {
pr_info("Argument[%d] name '%s' conflicts with "
prev parent reply other threads:[~2010-09-09 19:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-27 11:38 [PATCH -tip 0/5] Perf and tracing/kprobe fixes Masami Hiramatsu
2010-08-27 11:38 ` [PATCH -tip 1/5] tracing/kprobe: Fix a memory leak in error case Masami Hiramatsu
2010-09-09 19:43 ` [tip:perf/core] " tip-bot for Masami Hiramatsu
2010-08-27 11:38 ` [PATCH -tip 2/5] perf probe: Fix return probe support Masami Hiramatsu
2010-09-09 19:43 ` [tip:perf/core] " tip-bot for Masami Hiramatsu
2010-08-27 11:38 ` [PATCH -tip 3/5] perf probe: Don't make argument names from raw parameters Masami Hiramatsu
2010-09-09 19:43 ` [tip:perf/core] perf probe: Fix handling of arguments names tip-bot for Masami Hiramatsu
2010-08-27 11:39 ` [PATCH -tip 4/5] tracing/kprobes: Set a name for each argument automatically Masami Hiramatsu
2010-09-09 19:44 ` [tip:perf/core] tracing/kprobes: Fix handling of argument names tip-bot for Masami Hiramatsu
2010-08-27 11:39 ` [PATCH -tip 5/5] tracing/kprobe: Check invalid argument name Masami Hiramatsu
2010-09-09 19:44 ` tip-bot for Masami Hiramatsu [this message]
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=tip-da34634fd39958725310d2c30c9b4543945f968b@git.kernel.org \
--to=masami.hiramatsu.pt@hitachi.com \
--cc=acme@redhat.com \
--cc=fweisbec@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
--cc=srikar@linux.vnet.ibm.com \
--cc=tglx@linutronix.de \
/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