Merge tag 'v6.10' into android-mainline
Linux 6.10 Change-Id: I269322d76a64da16abf2f75a8f84328572a321e1 Signed-off-by: Matthias Maennich <maennich@google.com> Signed-off-by: Will McVicker <willmcvicker@google.com>
This commit is contained in:
@@ -1136,7 +1136,7 @@ config PREEMPTIRQ_DELAY_TEST
|
||||
|
||||
config SYNTH_EVENT_GEN_TEST
|
||||
tristate "Test module for in-kernel synthetic event generation"
|
||||
depends on SYNTH_EVENTS
|
||||
depends on SYNTH_EVENTS && m
|
||||
help
|
||||
This option creates a test module to check the base
|
||||
functionality of in-kernel synthetic event definition and
|
||||
@@ -1149,7 +1149,7 @@ config SYNTH_EVENT_GEN_TEST
|
||||
|
||||
config KPROBE_EVENT_GEN_TEST
|
||||
tristate "Test module for in-kernel kprobe event generation"
|
||||
depends on KPROBE_EVENTS
|
||||
depends on KPROBE_EVENTS && m
|
||||
help
|
||||
This option creates a test module to check the base
|
||||
functionality of in-kernel kprobe event definition.
|
||||
|
||||
@@ -3295,7 +3295,7 @@ static int uprobe_prog_run(struct bpf_uprobe *uprobe,
|
||||
struct bpf_run_ctx *old_run_ctx;
|
||||
int err = 0;
|
||||
|
||||
if (link->task && current != link->task)
|
||||
if (link->task && current->mm != link->task->mm)
|
||||
return 0;
|
||||
|
||||
if (sleepable)
|
||||
@@ -3396,8 +3396,9 @@ int bpf_uprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *pr
|
||||
upath = u64_to_user_ptr(attr->link_create.uprobe_multi.path);
|
||||
uoffsets = u64_to_user_ptr(attr->link_create.uprobe_multi.offsets);
|
||||
cnt = attr->link_create.uprobe_multi.cnt;
|
||||
pid = attr->link_create.uprobe_multi.pid;
|
||||
|
||||
if (!upath || !uoffsets || !cnt)
|
||||
if (!upath || !uoffsets || !cnt || pid < 0)
|
||||
return -EINVAL;
|
||||
if (cnt > MAX_UPROBE_MULTI_CNT)
|
||||
return -E2BIG;
|
||||
@@ -3421,11 +3422,8 @@ int bpf_uprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *pr
|
||||
goto error_path_put;
|
||||
}
|
||||
|
||||
pid = attr->link_create.uprobe_multi.pid;
|
||||
if (pid) {
|
||||
rcu_read_lock();
|
||||
task = get_pid_task(find_vpid(pid), PIDTYPE_PID);
|
||||
rcu_read_unlock();
|
||||
task = get_pid_task(find_vpid(pid), PIDTYPE_TGID);
|
||||
if (!task) {
|
||||
err = -ESRCH;
|
||||
goto error_path_put;
|
||||
@@ -3519,7 +3517,6 @@ static u64 bpf_uprobe_multi_entry_ip(struct bpf_run_ctx *ctx)
|
||||
}
|
||||
#endif /* CONFIG_UPROBES */
|
||||
|
||||
#ifdef CONFIG_FPROBE
|
||||
__bpf_kfunc_start_defs();
|
||||
|
||||
__bpf_kfunc bool bpf_session_is_return(void)
|
||||
@@ -3568,4 +3565,3 @@ static int __init bpf_kprobe_multi_kfuncs_init(void)
|
||||
}
|
||||
|
||||
late_initcall(bpf_kprobe_multi_kfuncs_init);
|
||||
#endif
|
||||
|
||||
@@ -6969,7 +6969,7 @@ allocate_ftrace_mod_map(struct module *mod,
|
||||
return mod_map;
|
||||
}
|
||||
|
||||
static const char *
|
||||
static int
|
||||
ftrace_func_address_lookup(struct ftrace_mod_map *mod_map,
|
||||
unsigned long addr, unsigned long *size,
|
||||
unsigned long *off, char *sym)
|
||||
@@ -6990,21 +6990,18 @@ ftrace_func_address_lookup(struct ftrace_mod_map *mod_map,
|
||||
*size = found_func->size;
|
||||
if (off)
|
||||
*off = addr - found_func->ip;
|
||||
if (sym)
|
||||
strscpy(sym, found_func->name, KSYM_NAME_LEN);
|
||||
|
||||
return found_func->name;
|
||||
return strscpy(sym, found_func->name, KSYM_NAME_LEN);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *
|
||||
int
|
||||
ftrace_mod_address_lookup(unsigned long addr, unsigned long *size,
|
||||
unsigned long *off, char **modname, char *sym)
|
||||
{
|
||||
struct ftrace_mod_map *mod_map;
|
||||
const char *ret = NULL;
|
||||
int ret = 0;
|
||||
|
||||
/* mod_map is freed via call_rcu() */
|
||||
preempt_disable();
|
||||
|
||||
@@ -554,6 +554,10 @@ static int parse_btf_field(char *fieldname, const struct btf_type *type,
|
||||
anon_offs = 0;
|
||||
field = btf_find_struct_member(ctx->btf, type, fieldname,
|
||||
&anon_offs);
|
||||
if (IS_ERR(field)) {
|
||||
trace_probe_log_err(ctx->offset, BAD_BTF_TID);
|
||||
return PTR_ERR(field);
|
||||
}
|
||||
if (!field) {
|
||||
trace_probe_log_err(ctx->offset, NO_BTF_FIELD);
|
||||
return -ENOENT;
|
||||
|
||||
@@ -970,19 +970,17 @@ static struct uprobe_cpu_buffer *prepare_uprobe_buffer(struct trace_uprobe *tu,
|
||||
|
||||
static void __uprobe_trace_func(struct trace_uprobe *tu,
|
||||
unsigned long func, struct pt_regs *regs,
|
||||
struct uprobe_cpu_buffer **ucbp,
|
||||
struct uprobe_cpu_buffer *ucb,
|
||||
struct trace_event_file *trace_file)
|
||||
{
|
||||
struct uprobe_trace_entry_head *entry;
|
||||
struct trace_event_buffer fbuffer;
|
||||
struct uprobe_cpu_buffer *ucb;
|
||||
void *data;
|
||||
int size, esize;
|
||||
struct trace_event_call *call = trace_probe_event_call(&tu->tp);
|
||||
|
||||
WARN_ON(call != trace_file->event_call);
|
||||
|
||||
ucb = prepare_uprobe_buffer(tu, regs, ucbp);
|
||||
if (WARN_ON_ONCE(ucb->dsize > PAGE_SIZE))
|
||||
return;
|
||||
|
||||
@@ -1014,13 +1012,16 @@ static int uprobe_trace_func(struct trace_uprobe *tu, struct pt_regs *regs,
|
||||
struct uprobe_cpu_buffer **ucbp)
|
||||
{
|
||||
struct event_file_link *link;
|
||||
struct uprobe_cpu_buffer *ucb;
|
||||
|
||||
if (is_ret_probe(tu))
|
||||
return 0;
|
||||
|
||||
ucb = prepare_uprobe_buffer(tu, regs, ucbp);
|
||||
|
||||
rcu_read_lock();
|
||||
trace_probe_for_each_link_rcu(link, &tu->tp)
|
||||
__uprobe_trace_func(tu, 0, regs, ucbp, link->file);
|
||||
__uprobe_trace_func(tu, 0, regs, ucb, link->file);
|
||||
rcu_read_unlock();
|
||||
|
||||
return 0;
|
||||
@@ -1031,10 +1032,13 @@ static void uretprobe_trace_func(struct trace_uprobe *tu, unsigned long func,
|
||||
struct uprobe_cpu_buffer **ucbp)
|
||||
{
|
||||
struct event_file_link *link;
|
||||
struct uprobe_cpu_buffer *ucb;
|
||||
|
||||
ucb = prepare_uprobe_buffer(tu, regs, ucbp);
|
||||
|
||||
rcu_read_lock();
|
||||
trace_probe_for_each_link_rcu(link, &tu->tp)
|
||||
__uprobe_trace_func(tu, func, regs, ucbp, link->file);
|
||||
__uprobe_trace_func(tu, func, regs, ucb, link->file);
|
||||
rcu_read_unlock();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user