Merge branch 'linus' into perf/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Šī revīzija ir iekļauta:
@@ -1707,20 +1707,26 @@ static int bpf_prog_load(union bpf_attr *attr, union bpf_attr __user *uattr)
|
||||
if (err)
|
||||
goto free_used_maps;
|
||||
|
||||
err = bpf_prog_new_fd(prog);
|
||||
if (err < 0) {
|
||||
/* failed to allocate fd.
|
||||
* bpf_prog_put() is needed because the above
|
||||
* bpf_prog_alloc_id() has published the prog
|
||||
* to the userspace and the userspace may
|
||||
* have refcnt-ed it through BPF_PROG_GET_FD_BY_ID.
|
||||
*/
|
||||
bpf_prog_put(prog);
|
||||
return err;
|
||||
}
|
||||
|
||||
/* Upon success of bpf_prog_alloc_id(), the BPF prog is
|
||||
* effectively publicly exposed. However, retrieving via
|
||||
* bpf_prog_get_fd_by_id() will take another reference,
|
||||
* therefore it cannot be gone underneath us.
|
||||
*
|
||||
* Only for the time /after/ successful bpf_prog_new_fd()
|
||||
* and before returning to userspace, we might just hold
|
||||
* one reference and any parallel close on that fd could
|
||||
* rip everything out. Hence, below notifications must
|
||||
* happen before bpf_prog_new_fd().
|
||||
*
|
||||
* Also, any failure handling from this point onwards must
|
||||
* be using bpf_prog_put() given the program is exposed.
|
||||
*/
|
||||
bpf_prog_kallsyms_add(prog);
|
||||
perf_event_bpf_event(prog, PERF_BPF_EVENT_PROG_LOAD, 0);
|
||||
|
||||
err = bpf_prog_new_fd(prog);
|
||||
if (err < 0)
|
||||
bpf_prog_put(prog);
|
||||
return err;
|
||||
|
||||
free_used_maps:
|
||||
|
@@ -985,9 +985,6 @@ static void __mark_reg_unbounded(struct bpf_reg_state *reg)
|
||||
reg->smax_value = S64_MAX;
|
||||
reg->umin_value = 0;
|
||||
reg->umax_value = U64_MAX;
|
||||
|
||||
/* constant backtracking is enabled for root only for now */
|
||||
reg->precise = capable(CAP_SYS_ADMIN) ? false : true;
|
||||
}
|
||||
|
||||
/* Mark a register as having a completely unknown (scalar) value. */
|
||||
@@ -1014,7 +1011,11 @@ static void mark_reg_unknown(struct bpf_verifier_env *env,
|
||||
__mark_reg_not_init(regs + regno);
|
||||
return;
|
||||
}
|
||||
__mark_reg_unknown(regs + regno);
|
||||
regs += regno;
|
||||
__mark_reg_unknown(regs);
|
||||
/* constant backtracking is enabled for root without bpf2bpf calls */
|
||||
regs->precise = env->subprog_cnt > 1 || !env->allow_ptr_leaks ?
|
||||
true : false;
|
||||
}
|
||||
|
||||
static void __mark_reg_not_init(struct bpf_reg_state *reg)
|
||||
|
@@ -263,8 +263,10 @@ int kallsyms_lookup_size_offset(unsigned long addr, unsigned long *symbolsize,
|
||||
{
|
||||
char namebuf[KSYM_NAME_LEN];
|
||||
|
||||
if (is_ksym_addr(addr))
|
||||
return !!get_symbol_pos(addr, symbolsize, offset);
|
||||
if (is_ksym_addr(addr)) {
|
||||
get_symbol_pos(addr, symbolsize, offset);
|
||||
return 1;
|
||||
}
|
||||
return !!module_address_lookup(addr, symbolsize, offset, NULL, namebuf) ||
|
||||
!!__bpf_address_lookup(addr, symbolsize, offset, namebuf);
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
|
Atsaukties uz šo jaunā problēmā
Block a user