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 -----BEGIN PGP SIGNATURE----- iIoEABYIADIWIQRRSw7ePDh/lE+zeZMp5XQQmuv6qgUCXWpTNRQccm9zdGVkdEBn b29kbWlzLm9yZwAKCRAp5XQQmuv6qpXtAPsGoHDHkgPIyl9bnV0oZfwLrAl4qEyg RpVp9ZMcG4UtMwEAp/SXRFzvL+EUiKyd1U3FZy2jhVec3+hX7SzIGqgONA4= =ee8V -----END PGP SIGNATURE----- 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()
This commit is contained in:
commit
95381debd9
|
@ -16,7 +16,6 @@
|
|||
#define HAVE_FUNCTION_GRAPH_RET_ADDR_PTR
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
extern void mcount(void);
|
||||
extern atomic_t modifying_ftrace_code;
|
||||
extern void __fentry__(void);
|
||||
|
||||
|
|
|
@ -548,6 +548,7 @@ extern int trace_event_get_offsets(struct trace_event_call *call);
|
|||
|
||||
#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);
|
||||
|
||||
/*
|
||||
|
|
|
@ -3095,6 +3095,14 @@ t_probe_next(struct seq_file *m, loff_t *pos)
|
|||
hnd = &iter->probe_entry->hlist;
|
||||
|
||||
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;
|
||||
|
||||
retry:
|
||||
|
@ -4320,12 +4328,21 @@ register_ftrace_function_probe(char *glob, struct trace_array *tr,
|
|||
|
||||
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);
|
||||
|
||||
orig_hash = &probe->ops.func_hash->filter_hash;
|
||||
old_hash = *orig_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));
|
||||
|
||||
/* Nothing found? */
|
||||
|
|
|
@ -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
|
||||
* @tr - tracer
|
||||
* @tsk - task with the latency
|
||||
* @cpu - the cpu of the buffer to copy.
|
||||
* @tr: tracer
|
||||
* @tsk: task with the latency
|
||||
* @cpu: the cpu of the buffer to copy.
|
||||
*
|
||||
* 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);
|
|||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
@ -2230,9 +2230,9 @@ static bool tracing_record_taskinfo_skip(int flags)
|
|||
/**
|
||||
* tracing_record_taskinfo - record the task info of a task
|
||||
*
|
||||
* @task - task to record
|
||||
* @flags - TRACE_RECORD_CMDLINE for recording comm
|
||||
* - TRACE_RECORD_TGID for recording tgid
|
||||
* @task: task to record
|
||||
* @flags: TRACE_RECORD_CMDLINE for recording comm
|
||||
* TRACE_RECORD_TGID for recording tgid
|
||||
*/
|
||||
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
|
||||
*
|
||||
* @prev - previous task during sched_switch
|
||||
* @next - next task during sched_switch
|
||||
* @flags - TRACE_RECORD_CMDLINE for recording comm
|
||||
* TRACE_RECORD_TGID for recording tgid
|
||||
* @prev: previous task during sched_switch
|
||||
* @next: next task during sched_switch
|
||||
* @flags: TRACE_RECORD_CMDLINE for recording comm
|
||||
* TRACE_RECORD_TGID for recording tgid
|
||||
*/
|
||||
void tracing_record_taskinfo_sched_switch(struct task_struct *prev,
|
||||
struct task_struct *next, int flags)
|
||||
|
@ -3072,7 +3072,9 @@ static void trace_printk_start_stop_comm(int enabled)
|
|||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
|
|
|
@ -787,7 +787,7 @@ static int __ftrace_set_clr_event(struct trace_array *tr, const char *match,
|
|||
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;
|
||||
int ret;
|
||||
|
|
|
@ -895,7 +895,8 @@ void trace_probe_cleanup(struct trace_probe *tp)
|
|||
for (i = 0; i < tp->nr_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->print_fmt);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue