Commit c0a0c7a4 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'trace-v4.12-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace

Pull last-minute tracing fixes from Steven Rostedt:
 "Two fixes:

  One is for a crash when using the :mod: trace probe command into
  stack_trace_filter. This bug was introduced during the last merge
  window.

  The other was there forever. It's a small bug that makes it impossible
  to name a module function for kprobes when the module starts with a
  digit"

* tag 'trace-v4.12-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
  tracing/kprobes: Allow to create probe with a module name starting with a digit
  ftrace: Fix regression with module command in stack_trace_filter
parents fbd57629 9e52b325
...@@ -4337,9 +4337,6 @@ static int ftrace_process_regex(struct ftrace_iterator *iter, ...@@ -4337,9 +4337,6 @@ static int ftrace_process_regex(struct ftrace_iterator *iter,
command = strsep(&next, ":"); command = strsep(&next, ":");
if (WARN_ON_ONCE(!tr))
return -EINVAL;
mutex_lock(&ftrace_cmd_mutex); mutex_lock(&ftrace_cmd_mutex);
list_for_each_entry(p, &ftrace_commands, list) { list_for_each_entry(p, &ftrace_commands, list) {
if (strcmp(p->name, command) == 0) { if (strcmp(p->name, command) == 0) {
......
...@@ -6881,6 +6881,9 @@ ftrace_trace_snapshot_callback(struct trace_array *tr, struct ftrace_hash *hash, ...@@ -6881,6 +6881,9 @@ ftrace_trace_snapshot_callback(struct trace_array *tr, struct ftrace_hash *hash,
char *number; char *number;
int ret; int ret;
if (!tr)
return -ENODEV;
/* hash funcs only work with set_ftrace_filter */ /* hash funcs only work with set_ftrace_filter */
if (!enable) if (!enable)
return -EINVAL; return -EINVAL;
......
...@@ -654,6 +654,9 @@ ftrace_trace_onoff_callback(struct trace_array *tr, struct ftrace_hash *hash, ...@@ -654,6 +654,9 @@ ftrace_trace_onoff_callback(struct trace_array *tr, struct ftrace_hash *hash,
{ {
struct ftrace_probe_ops *ops; struct ftrace_probe_ops *ops;
if (!tr)
return -ENODEV;
/* we register both traceon and traceoff to this callback */ /* we register both traceon and traceoff to this callback */
if (strcmp(cmd, "traceon") == 0) if (strcmp(cmd, "traceon") == 0)
ops = param ? &traceon_count_probe_ops : &traceon_probe_ops; ops = param ? &traceon_count_probe_ops : &traceon_probe_ops;
...@@ -670,6 +673,9 @@ ftrace_stacktrace_callback(struct trace_array *tr, struct ftrace_hash *hash, ...@@ -670,6 +673,9 @@ ftrace_stacktrace_callback(struct trace_array *tr, struct ftrace_hash *hash,
{ {
struct ftrace_probe_ops *ops; struct ftrace_probe_ops *ops;
if (!tr)
return -ENODEV;
ops = param ? &stacktrace_count_probe_ops : &stacktrace_probe_ops; ops = param ? &stacktrace_count_probe_ops : &stacktrace_probe_ops;
return ftrace_trace_probe_callback(tr, ops, hash, glob, cmd, return ftrace_trace_probe_callback(tr, ops, hash, glob, cmd,
...@@ -682,6 +688,9 @@ ftrace_dump_callback(struct trace_array *tr, struct ftrace_hash *hash, ...@@ -682,6 +688,9 @@ ftrace_dump_callback(struct trace_array *tr, struct ftrace_hash *hash,
{ {
struct ftrace_probe_ops *ops; struct ftrace_probe_ops *ops;
if (!tr)
return -ENODEV;
ops = &dump_probe_ops; ops = &dump_probe_ops;
/* Only dump once. */ /* Only dump once. */
...@@ -695,6 +704,9 @@ ftrace_cpudump_callback(struct trace_array *tr, struct ftrace_hash *hash, ...@@ -695,6 +704,9 @@ ftrace_cpudump_callback(struct trace_array *tr, struct ftrace_hash *hash,
{ {
struct ftrace_probe_ops *ops; struct ftrace_probe_ops *ops;
if (!tr)
return -ENODEV;
ops = &cpudump_probe_ops; ops = &cpudump_probe_ops;
/* Only dump once. */ /* Only dump once. */
......
...@@ -707,20 +707,16 @@ static int create_trace_kprobe(int argc, char **argv) ...@@ -707,20 +707,16 @@ static int create_trace_kprobe(int argc, char **argv)
pr_info("Probe point is not specified.\n"); pr_info("Probe point is not specified.\n");
return -EINVAL; return -EINVAL;
} }
if (isdigit(argv[1][0])) {
/* an address specified */ /* try to parse an address. if that fails, try to read the
ret = kstrtoul(&argv[1][0], 0, (unsigned long *)&addr); * input as a symbol. */
if (ret) { if (kstrtoul(argv[1], 0, (unsigned long *)&addr)) {
pr_info("Failed to parse address.\n");
return ret;
}
} else {
/* a symbol specified */ /* a symbol specified */
symbol = argv[1]; symbol = argv[1];
/* TODO: support .init module functions */ /* TODO: support .init module functions */
ret = traceprobe_split_symbol_offset(symbol, &offset); ret = traceprobe_split_symbol_offset(symbol, &offset);
if (ret) { if (ret) {
pr_info("Failed to parse symbol.\n"); pr_info("Failed to parse either an address or a symbol.\n");
return ret; return ret;
} }
if (offset && is_return && if (offset && is_return &&
......
...@@ -409,7 +409,9 @@ static const struct file_operations stack_trace_fops = { ...@@ -409,7 +409,9 @@ static const struct file_operations stack_trace_fops = {
static int static int
stack_trace_filter_open(struct inode *inode, struct file *file) stack_trace_filter_open(struct inode *inode, struct file *file)
{ {
return ftrace_regex_open(&trace_ops, FTRACE_ITER_FILTER, struct ftrace_ops *ops = inode->i_private;
return ftrace_regex_open(ops, FTRACE_ITER_FILTER,
inode, file); inode, file);
} }
...@@ -476,7 +478,7 @@ static __init int stack_trace_init(void) ...@@ -476,7 +478,7 @@ static __init int stack_trace_init(void)
NULL, &stack_trace_fops); NULL, &stack_trace_fops);
trace_create_file("stack_trace_filter", 0444, d_tracer, trace_create_file("stack_trace_filter", 0444, d_tracer,
NULL, &stack_trace_filter_fops); &trace_ops, &stack_trace_filter_fops);
if (stack_trace_filter_buf[0]) if (stack_trace_filter_buf[0])
ftrace_set_early_filter(&trace_ops, stack_trace_filter_buf, 1); ftrace_set_early_filter(&trace_ops, stack_trace_filter_buf, 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment