Commit 95381deb authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'trace-v5.3-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace

Pull tracing fixes from Steven Rostedt:
 "Small fixes and minor cleanups for tracing:

   - Make exported ftrace function not static

   - Fix NULL pointer dereference in reading probes as they are created

   - Fix NULL pointer dereference in k/uprobe clean up path

   - Various documentation fixes"

* tag 'trace-v5.3-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
  tracing: Correct kdoc formats
  ftrace/x86: Remove mcount() declaration
  tracing/probe: Fix null pointer dereference
  tracing: Make exported ftrace_set_clr_event non-static
  ftrace: Check for successful allocation of hash
  ftrace: Check for empty hash and comment the race with registering probes
  ftrace: Fix NULL pointer dereference in t_probe_next()
parents 7fb86707 c68c9ec1
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#define HAVE_FUNCTION_GRAPH_RET_ADDR_PTR #define HAVE_FUNCTION_GRAPH_RET_ADDR_PTR
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
extern void mcount(void);
extern atomic_t modifying_ftrace_code; extern atomic_t modifying_ftrace_code;
extern void __fentry__(void); extern void __fentry__(void);
......
...@@ -548,6 +548,7 @@ extern int trace_event_get_offsets(struct trace_event_call *call); ...@@ -548,6 +548,7 @@ extern int trace_event_get_offsets(struct trace_event_call *call);
#define is_signed_type(type) (((type)(-1)) < (type)1) #define is_signed_type(type) (((type)(-1)) < (type)1)
int ftrace_set_clr_event(struct trace_array *tr, char *buf, int set);
int trace_set_clr_event(const char *system, const char *event, int set); int trace_set_clr_event(const char *system, const char *event, int set);
/* /*
......
...@@ -3095,6 +3095,14 @@ t_probe_next(struct seq_file *m, loff_t *pos) ...@@ -3095,6 +3095,14 @@ t_probe_next(struct seq_file *m, loff_t *pos)
hnd = &iter->probe_entry->hlist; hnd = &iter->probe_entry->hlist;
hash = iter->probe->ops.func_hash->filter_hash; hash = iter->probe->ops.func_hash->filter_hash;
/*
* A probe being registered may temporarily have an empty hash
* and it's at the end of the func_probes list.
*/
if (!hash || hash == EMPTY_HASH)
return NULL;
size = 1 << hash->size_bits; size = 1 << hash->size_bits;
retry: retry:
...@@ -4320,12 +4328,21 @@ register_ftrace_function_probe(char *glob, struct trace_array *tr, ...@@ -4320,12 +4328,21 @@ register_ftrace_function_probe(char *glob, struct trace_array *tr,
mutex_unlock(&ftrace_lock); mutex_unlock(&ftrace_lock);
/*
* Note, there's a small window here that the func_hash->filter_hash
* may be NULL or empty. Need to be carefule when reading the loop.
*/
mutex_lock(&probe->ops.func_hash->regex_lock); mutex_lock(&probe->ops.func_hash->regex_lock);
orig_hash = &probe->ops.func_hash->filter_hash; orig_hash = &probe->ops.func_hash->filter_hash;
old_hash = *orig_hash; old_hash = *orig_hash;
hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, old_hash); hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, old_hash);
if (!hash) {
ret = -ENOMEM;
goto out;
}
ret = ftrace_match_records(hash, glob, strlen(glob)); ret = ftrace_match_records(hash, glob, strlen(glob));
/* Nothing found? */ /* Nothing found? */
......
...@@ -1567,9 +1567,9 @@ update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu, ...@@ -1567,9 +1567,9 @@ update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu,
/** /**
* update_max_tr_single - only copy one trace over, and reset the rest * update_max_tr_single - only copy one trace over, and reset the rest
* @tr - tracer * @tr: tracer
* @tsk - task with the latency * @tsk: task with the latency
* @cpu - the cpu of the buffer to copy. * @cpu: the cpu of the buffer to copy.
* *
* Flip the trace of a single CPU buffer between the @tr and the max_tr. * Flip the trace of a single CPU buffer between the @tr and the max_tr.
*/ */
...@@ -1767,7 +1767,7 @@ static void __init apply_trace_boot_options(void); ...@@ -1767,7 +1767,7 @@ static void __init apply_trace_boot_options(void);
/** /**
* register_tracer - register a tracer with the ftrace system. * register_tracer - register a tracer with the ftrace system.
* @type - the plugin for the tracer * @type: the plugin for the tracer
* *
* Register a new plugin tracer. * Register a new plugin tracer.
*/ */
...@@ -2230,9 +2230,9 @@ static bool tracing_record_taskinfo_skip(int flags) ...@@ -2230,9 +2230,9 @@ static bool tracing_record_taskinfo_skip(int flags)
/** /**
* tracing_record_taskinfo - record the task info of a task * tracing_record_taskinfo - record the task info of a task
* *
* @task - task to record * @task: task to record
* @flags - TRACE_RECORD_CMDLINE for recording comm * @flags: TRACE_RECORD_CMDLINE for recording comm
* - TRACE_RECORD_TGID for recording tgid * TRACE_RECORD_TGID for recording tgid
*/ */
void tracing_record_taskinfo(struct task_struct *task, int flags) void tracing_record_taskinfo(struct task_struct *task, int flags)
{ {
...@@ -2258,10 +2258,10 @@ void tracing_record_taskinfo(struct task_struct *task, int flags) ...@@ -2258,10 +2258,10 @@ void tracing_record_taskinfo(struct task_struct *task, int flags)
/** /**
* tracing_record_taskinfo_sched_switch - record task info for sched_switch * tracing_record_taskinfo_sched_switch - record task info for sched_switch
* *
* @prev - previous task during sched_switch * @prev: previous task during sched_switch
* @next - next task during sched_switch * @next: next task during sched_switch
* @flags - TRACE_RECORD_CMDLINE for recording comm * @flags: TRACE_RECORD_CMDLINE for recording comm
* TRACE_RECORD_TGID for recording tgid * TRACE_RECORD_TGID for recording tgid
*/ */
void tracing_record_taskinfo_sched_switch(struct task_struct *prev, void tracing_record_taskinfo_sched_switch(struct task_struct *prev,
struct task_struct *next, int flags) struct task_struct *next, int flags)
...@@ -3072,7 +3072,9 @@ static void trace_printk_start_stop_comm(int enabled) ...@@ -3072,7 +3072,9 @@ static void trace_printk_start_stop_comm(int enabled)
/** /**
* trace_vbprintk - write binary msg to tracing buffer * trace_vbprintk - write binary msg to tracing buffer
* * @ip: The address of the caller
* @fmt: The string format to write to the buffer
* @args: Arguments for @fmt
*/ */
int trace_vbprintk(unsigned long ip, const char *fmt, va_list args) int trace_vbprintk(unsigned long ip, const char *fmt, va_list args)
{ {
......
...@@ -787,7 +787,7 @@ static int __ftrace_set_clr_event(struct trace_array *tr, const char *match, ...@@ -787,7 +787,7 @@ static int __ftrace_set_clr_event(struct trace_array *tr, const char *match,
return ret; return ret;
} }
static int ftrace_set_clr_event(struct trace_array *tr, char *buf, int set) int ftrace_set_clr_event(struct trace_array *tr, char *buf, int set)
{ {
char *event = NULL, *sub = NULL, *match; char *event = NULL, *sub = NULL, *match;
int ret; int ret;
......
...@@ -895,7 +895,8 @@ void trace_probe_cleanup(struct trace_probe *tp) ...@@ -895,7 +895,8 @@ void trace_probe_cleanup(struct trace_probe *tp)
for (i = 0; i < tp->nr_args; i++) for (i = 0; i < tp->nr_args; i++)
traceprobe_free_probe_arg(&tp->args[i]); traceprobe_free_probe_arg(&tp->args[i]);
kfree(call->class->system); if (call->class)
kfree(call->class->system);
kfree(call->name); kfree(call->name);
kfree(call->print_fmt); kfree(call->print_fmt);
} }
......
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