Commit 87e098e6 authored by Alexei Starovoitov's avatar Alexei Starovoitov

Merge branch 'bpf: Support ->fill_link_info for kprobe_multi and perf_event links'

Yafang Shao says:

====================
This patchset enhances the usability of kprobe_multi program by introducing
support for ->fill_link_info. This allows users to easily determine the
probed functions associated with a kprobe_multi program. While
`bpftool perf show` already provides information about functions probed by
perf_event programs, supporting ->fill_link_info ensures consistent access
to this information across all bpf links.

In addition, this patch extends support to generic perf events, which are
currently not covered by `bpftool perf show`. While userspace is exposed to
only the perf type and config, other attributes such as sample_period and
sample_freq are disregarded.

To ensure accurate identification of probed functions, it is preferable to
expose the address directly rather than relying solely on the symbol name.
However, this implementation respects the kptr_restrict setting and avoids
exposing the address if it is not permitted.

v6->v7:
- From Daniel
  - No need to explicitly cast in many places
  - Use ptr_to_u64() instead of the cast
  - return -ENOMEM when calloc fails
  - Simplify the code in bpf_get_kprobe_info() further
  - Squash #9 with #8
  - And other coding style improvement
- From Andrii
  - Comment improvement
  - Use ENOSPC instead of E2BIG
  - Use strlen only when buf in not NULL
- Clear probe_addr in bpf_get_uprobe_info()

v5->v6:
- From Andrii
  - if ucount is too less, copy ucount items and return -E2BIG
  - zero out kmulti_link->cnt elements if it is not permitted by kptr
  - avoid leaking information when ucount is greater than kmulti_link->cnt
  - drop the flags, and add BPF_PERF_EVENT_[UK]RETPROBE
- From Quentin
  - use jsonw_null instead when we have no module name
  - add explanation on perf_type_name in the commit log
  - avoid the unnecessary out lable

v4->v5:
- Print "func [module]" in the kprobe_multi header (Andrii)
- Remove MAX_BPF_PERF_EVENT_TYPE (Alexei)
- Add padding field for future reuse (Yonghong)

v3->v4:
- From Quentin
  - Rename MODULE_NAME_LEN to MODULE_MAX_NAME
  - Convert retprobe to boolean for json output
  - Trim the square brackets around module names for json output
  - Move perf names into link.c
  - Use a generic helper to get perf names
  - Show address before func name, for consistency
  - Use switch-case instead of if-else
  - Increase the buff len to PATH_MAX
  - Move macros to the top of the file
- From Andrii
  - kprobe_multi flags should always be returned
  - Keep it single line if it fits in under 100 characters
  - Change the output format when showing kprobe_multi
  - Imporve the format of perf_event names
  - Rename struct perf_link to struct perf_event, and change the names of
    the enum consequently
- From Yonghong
  - Avoid disallowing extensions for all structs in the big union
- From Jiri
  - Add flags to bpf_kprobe_multi_link
  - Report kprobe_multi selftests errors
  - Rename bpf_perf_link_fill_name and make it a separate patch
  - Avoid breaking compilation when CONFIG_KPROBE_EVENTS or
    CONFIG_UPROBE_EVENTS options are not defined

v2->v3:
- Expose flags instead of retporbe (Andrii)
- Simplify the check on kmulti_link->cnt (Andrii)
- Use kallsyms_show_value() instead (Andrii)
- Show also the module name for kprobe_multi (Andrii)
- Add new enum bpf_perf_link_type (Andrii)
- Move perf event names into bpftool (Andrii, Quentin, Jiri)
- Keep perf event names in sync with perf tools (Jiri)

v1->v2:
- Fix sparse warning (Stanislav, lkp@intel.com)
- Fix BPF CI build error
- Reuse kernel_syms_load() (Alexei)
- Print 'name' instead of 'func' (Alexei)
- Show whether the probe is retprobe or not (Andrii)
- Add comment for the meaning of perf_event name (Andrii)
- Add support for generic perf event
- Adhere to the kptr_restrict setting

RFC->v1:
- Use a single copy_to_user() instead (Jiri)
- Show also the symbol name in bpftool (Quentin, Alexei)
- Use calloc() instead of malloc() in bpftool (Quentin)
- Avoid having conditional entries in the JSON output (Quentin)
- Drop ->show_fdinfo (Alexei)
- Use __u64 instead of __aligned_u64 for the field addr (Alexei)
- Avoid the contradiction in perf_event name length (Alexei)
- Address a build warning reported by kernel test robot <lkp@intel.com>
====================
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parents 07018b57 88d61607
...@@ -864,7 +864,8 @@ extern int perf_uprobe_init(struct perf_event *event, ...@@ -864,7 +864,8 @@ extern int perf_uprobe_init(struct perf_event *event,
extern void perf_uprobe_destroy(struct perf_event *event); extern void perf_uprobe_destroy(struct perf_event *event);
extern int bpf_get_uprobe_info(const struct perf_event *event, extern int bpf_get_uprobe_info(const struct perf_event *event,
u32 *fd_type, const char **filename, u32 *fd_type, const char **filename,
u64 *probe_offset, bool perf_type_tracepoint); u64 *probe_offset, u64 *probe_addr,
bool perf_type_tracepoint);
#endif #endif
extern int ftrace_profile_set_filter(struct perf_event *event, int event_id, extern int ftrace_profile_set_filter(struct perf_event *event, int event_id,
char *filter_str); char *filter_str);
......
...@@ -1057,6 +1057,16 @@ enum bpf_link_type { ...@@ -1057,6 +1057,16 @@ enum bpf_link_type {
MAX_BPF_LINK_TYPE, MAX_BPF_LINK_TYPE,
}; };
enum bpf_perf_event_type {
BPF_PERF_EVENT_UNSPEC = 0,
BPF_PERF_EVENT_UPROBE = 1,
BPF_PERF_EVENT_URETPROBE = 2,
BPF_PERF_EVENT_KPROBE = 3,
BPF_PERF_EVENT_KRETPROBE = 4,
BPF_PERF_EVENT_TRACEPOINT = 5,
BPF_PERF_EVENT_EVENT = 6,
};
/* cgroup-bpf attach flags used in BPF_PROG_ATTACH command /* cgroup-bpf attach flags used in BPF_PROG_ATTACH command
* *
* NONE(default): No further bpf programs allowed in the subtree. * NONE(default): No further bpf programs allowed in the subtree.
...@@ -6439,6 +6449,36 @@ struct bpf_link_info { ...@@ -6439,6 +6449,36 @@ struct bpf_link_info {
__s32 priority; __s32 priority;
__u32 flags; __u32 flags;
} netfilter; } netfilter;
struct {
__aligned_u64 addrs;
__u32 count; /* in/out: kprobe_multi function count */
__u32 flags;
} kprobe_multi;
struct {
__u32 type; /* enum bpf_perf_event_type */
__u32 :32;
union {
struct {
__aligned_u64 file_name; /* in/out */
__u32 name_len;
__u32 offset; /* offset from file_name */
} uprobe; /* BPF_PERF_EVENT_UPROBE, BPF_PERF_EVENT_URETPROBE */
struct {
__aligned_u64 func_name; /* in/out */
__u32 name_len;
__u32 offset; /* offset from func_name */
__u64 addr;
} kprobe; /* BPF_PERF_EVENT_KPROBE, BPF_PERF_EVENT_KRETPROBE */
struct {
__aligned_u64 tp_name; /* in/out */
__u32 name_len;
} tracepoint; /* BPF_PERF_EVENT_TRACEPOINT */
struct {
__u64 config;
__u32 type;
} event; /* BPF_PERF_EVENT_EVENT */
};
} perf_event;
}; };
} __attribute__((aligned(8))); } __attribute__((aligned(8)));
......
...@@ -3295,6 +3295,25 @@ static void bpf_raw_tp_link_show_fdinfo(const struct bpf_link *link, ...@@ -3295,6 +3295,25 @@ static void bpf_raw_tp_link_show_fdinfo(const struct bpf_link *link,
raw_tp_link->btp->tp->name); raw_tp_link->btp->tp->name);
} }
static int bpf_copy_to_user(char __user *ubuf, const char *buf, u32 ulen,
u32 len)
{
if (ulen >= len + 1) {
if (copy_to_user(ubuf, buf, len + 1))
return -EFAULT;
} else {
char zero = '\0';
if (copy_to_user(ubuf, buf, ulen - 1))
return -EFAULT;
if (put_user(zero, ubuf + ulen - 1))
return -EFAULT;
return -ENOSPC;
}
return 0;
}
static int bpf_raw_tp_link_fill_link_info(const struct bpf_link *link, static int bpf_raw_tp_link_fill_link_info(const struct bpf_link *link,
struct bpf_link_info *info) struct bpf_link_info *info)
{ {
...@@ -3313,20 +3332,7 @@ static int bpf_raw_tp_link_fill_link_info(const struct bpf_link *link, ...@@ -3313,20 +3332,7 @@ static int bpf_raw_tp_link_fill_link_info(const struct bpf_link *link,
if (!ubuf) if (!ubuf)
return 0; return 0;
if (ulen >= tp_len + 1) { return bpf_copy_to_user(ubuf, tp_name, ulen, tp_len);
if (copy_to_user(ubuf, tp_name, tp_len + 1))
return -EFAULT;
} else {
char zero = '\0';
if (copy_to_user(ubuf, tp_name, ulen - 1))
return -EFAULT;
if (put_user(zero, ubuf + ulen - 1))
return -EFAULT;
return -ENOSPC;
}
return 0;
} }
static const struct bpf_link_ops bpf_raw_tp_link_lops = { static const struct bpf_link_ops bpf_raw_tp_link_lops = {
...@@ -3358,9 +3364,155 @@ static void bpf_perf_link_dealloc(struct bpf_link *link) ...@@ -3358,9 +3364,155 @@ static void bpf_perf_link_dealloc(struct bpf_link *link)
kfree(perf_link); kfree(perf_link);
} }
static int bpf_perf_link_fill_common(const struct perf_event *event,
char __user *uname, u32 ulen,
u64 *probe_offset, u64 *probe_addr,
u32 *fd_type)
{
const char *buf;
u32 prog_id;
size_t len;
int err;
if (!ulen ^ !uname)
return -EINVAL;
if (!uname)
return 0;
err = bpf_get_perf_event_info(event, &prog_id, fd_type, &buf,
probe_offset, probe_addr);
if (err)
return err;
if (buf) {
len = strlen(buf);
err = bpf_copy_to_user(uname, buf, ulen, len);
if (err)
return err;
} else {
char zero = '\0';
if (put_user(zero, uname))
return -EFAULT;
}
return 0;
}
#ifdef CONFIG_KPROBE_EVENTS
static int bpf_perf_link_fill_kprobe(const struct perf_event *event,
struct bpf_link_info *info)
{
char __user *uname;
u64 addr, offset;
u32 ulen, type;
int err;
uname = u64_to_user_ptr(info->perf_event.kprobe.func_name);
ulen = info->perf_event.kprobe.name_len;
err = bpf_perf_link_fill_common(event, uname, ulen, &offset, &addr,
&type);
if (err)
return err;
if (type == BPF_FD_TYPE_KRETPROBE)
info->perf_event.type = BPF_PERF_EVENT_KRETPROBE;
else
info->perf_event.type = BPF_PERF_EVENT_KPROBE;
info->perf_event.kprobe.offset = offset;
if (!kallsyms_show_value(current_cred()))
addr = 0;
info->perf_event.kprobe.addr = addr;
return 0;
}
#endif
#ifdef CONFIG_UPROBE_EVENTS
static int bpf_perf_link_fill_uprobe(const struct perf_event *event,
struct bpf_link_info *info)
{
char __user *uname;
u64 addr, offset;
u32 ulen, type;
int err;
uname = u64_to_user_ptr(info->perf_event.uprobe.file_name);
ulen = info->perf_event.uprobe.name_len;
err = bpf_perf_link_fill_common(event, uname, ulen, &offset, &addr,
&type);
if (err)
return err;
if (type == BPF_FD_TYPE_URETPROBE)
info->perf_event.type = BPF_PERF_EVENT_URETPROBE;
else
info->perf_event.type = BPF_PERF_EVENT_UPROBE;
info->perf_event.uprobe.offset = offset;
return 0;
}
#endif
static int bpf_perf_link_fill_probe(const struct perf_event *event,
struct bpf_link_info *info)
{
#ifdef CONFIG_KPROBE_EVENTS
if (event->tp_event->flags & TRACE_EVENT_FL_KPROBE)
return bpf_perf_link_fill_kprobe(event, info);
#endif
#ifdef CONFIG_UPROBE_EVENTS
if (event->tp_event->flags & TRACE_EVENT_FL_UPROBE)
return bpf_perf_link_fill_uprobe(event, info);
#endif
return -EOPNOTSUPP;
}
static int bpf_perf_link_fill_tracepoint(const struct perf_event *event,
struct bpf_link_info *info)
{
char __user *uname;
u32 ulen;
uname = u64_to_user_ptr(info->perf_event.tracepoint.tp_name);
ulen = info->perf_event.tracepoint.name_len;
info->perf_event.type = BPF_PERF_EVENT_TRACEPOINT;
return bpf_perf_link_fill_common(event, uname, ulen, NULL, NULL, NULL);
}
static int bpf_perf_link_fill_perf_event(const struct perf_event *event,
struct bpf_link_info *info)
{
info->perf_event.event.type = event->attr.type;
info->perf_event.event.config = event->attr.config;
info->perf_event.type = BPF_PERF_EVENT_EVENT;
return 0;
}
static int bpf_perf_link_fill_link_info(const struct bpf_link *link,
struct bpf_link_info *info)
{
struct bpf_perf_link *perf_link;
const struct perf_event *event;
perf_link = container_of(link, struct bpf_perf_link, link);
event = perf_get_event(perf_link->perf_file);
if (IS_ERR(event))
return PTR_ERR(event);
switch (event->prog->type) {
case BPF_PROG_TYPE_PERF_EVENT:
return bpf_perf_link_fill_perf_event(event, info);
case BPF_PROG_TYPE_TRACEPOINT:
return bpf_perf_link_fill_tracepoint(event, info);
case BPF_PROG_TYPE_KPROBE:
return bpf_perf_link_fill_probe(event, info);
default:
return -EOPNOTSUPP;
}
}
static const struct bpf_link_ops bpf_perf_link_lops = { static const struct bpf_link_ops bpf_perf_link_lops = {
.release = bpf_perf_link_release, .release = bpf_perf_link_release,
.dealloc = bpf_perf_link_dealloc, .dealloc = bpf_perf_link_dealloc,
.fill_link_info = bpf_perf_link_fill_link_info,
}; };
static int bpf_perf_link_attach(const union bpf_attr *attr, struct bpf_prog *prog) static int bpf_perf_link_attach(const union bpf_attr *attr, struct bpf_prog *prog)
......
...@@ -2369,8 +2369,12 @@ int bpf_get_perf_event_info(const struct perf_event *event, u32 *prog_id, ...@@ -2369,8 +2369,12 @@ int bpf_get_perf_event_info(const struct perf_event *event, u32 *prog_id,
if (is_tracepoint || is_syscall_tp) { if (is_tracepoint || is_syscall_tp) {
*buf = is_tracepoint ? event->tp_event->tp->name *buf = is_tracepoint ? event->tp_event->tp->name
: event->tp_event->name; : event->tp_event->name;
/* We allow NULL pointer for tracepoint */
if (fd_type)
*fd_type = BPF_FD_TYPE_TRACEPOINT; *fd_type = BPF_FD_TYPE_TRACEPOINT;
if (probe_offset)
*probe_offset = 0x0; *probe_offset = 0x0;
if (probe_addr)
*probe_addr = 0x0; *probe_addr = 0x0;
} else { } else {
/* kprobe/uprobe */ /* kprobe/uprobe */
...@@ -2384,7 +2388,7 @@ int bpf_get_perf_event_info(const struct perf_event *event, u32 *prog_id, ...@@ -2384,7 +2388,7 @@ int bpf_get_perf_event_info(const struct perf_event *event, u32 *prog_id,
#ifdef CONFIG_UPROBE_EVENTS #ifdef CONFIG_UPROBE_EVENTS
if (flags & TRACE_EVENT_FL_UPROBE) if (flags & TRACE_EVENT_FL_UPROBE)
err = bpf_get_uprobe_info(event, fd_type, buf, err = bpf_get_uprobe_info(event, fd_type, buf,
probe_offset, probe_offset, probe_addr,
event->attr.type == PERF_TYPE_TRACEPOINT); event->attr.type == PERF_TYPE_TRACEPOINT);
#endif #endif
} }
...@@ -2469,6 +2473,7 @@ struct bpf_kprobe_multi_link { ...@@ -2469,6 +2473,7 @@ struct bpf_kprobe_multi_link {
u32 cnt; u32 cnt;
u32 mods_cnt; u32 mods_cnt;
struct module **mods; struct module **mods;
u32 flags;
}; };
struct bpf_kprobe_multi_run_ctx { struct bpf_kprobe_multi_run_ctx {
...@@ -2558,9 +2563,44 @@ static void bpf_kprobe_multi_link_dealloc(struct bpf_link *link) ...@@ -2558,9 +2563,44 @@ static void bpf_kprobe_multi_link_dealloc(struct bpf_link *link)
kfree(kmulti_link); kfree(kmulti_link);
} }
static int bpf_kprobe_multi_link_fill_link_info(const struct bpf_link *link,
struct bpf_link_info *info)
{
u64 __user *uaddrs = u64_to_user_ptr(info->kprobe_multi.addrs);
struct bpf_kprobe_multi_link *kmulti_link;
u32 ucount = info->kprobe_multi.count;
int err = 0, i;
if (!uaddrs ^ !ucount)
return -EINVAL;
kmulti_link = container_of(link, struct bpf_kprobe_multi_link, link);
info->kprobe_multi.count = kmulti_link->cnt;
info->kprobe_multi.flags = kmulti_link->flags;
if (!uaddrs)
return 0;
if (ucount < kmulti_link->cnt)
err = -ENOSPC;
else
ucount = kmulti_link->cnt;
if (kallsyms_show_value(current_cred())) {
if (copy_to_user(uaddrs, kmulti_link->addrs, ucount * sizeof(u64)))
return -EFAULT;
} else {
for (i = 0; i < ucount; i++) {
if (put_user(0, uaddrs + i))
return -EFAULT;
}
}
return err;
}
static const struct bpf_link_ops bpf_kprobe_multi_link_lops = { static const struct bpf_link_ops bpf_kprobe_multi_link_lops = {
.release = bpf_kprobe_multi_link_release, .release = bpf_kprobe_multi_link_release,
.dealloc = bpf_kprobe_multi_link_dealloc, .dealloc = bpf_kprobe_multi_link_dealloc,
.fill_link_info = bpf_kprobe_multi_link_fill_link_info,
}; };
static void bpf_kprobe_multi_cookie_swap(void *a, void *b, int size, const void *priv) static void bpf_kprobe_multi_cookie_swap(void *a, void *b, int size, const void *priv)
...@@ -2872,6 +2912,7 @@ int bpf_kprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *pr ...@@ -2872,6 +2912,7 @@ int bpf_kprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *pr
link->addrs = addrs; link->addrs = addrs;
link->cookies = cookies; link->cookies = cookies;
link->cnt = cnt; link->cnt = cnt;
link->flags = flags;
if (cookies) { if (cookies) {
/* /*
......
...@@ -1544,15 +1544,10 @@ int bpf_get_kprobe_info(const struct perf_event *event, u32 *fd_type, ...@@ -1544,15 +1544,10 @@ int bpf_get_kprobe_info(const struct perf_event *event, u32 *fd_type,
*fd_type = trace_kprobe_is_return(tk) ? BPF_FD_TYPE_KRETPROBE *fd_type = trace_kprobe_is_return(tk) ? BPF_FD_TYPE_KRETPROBE
: BPF_FD_TYPE_KPROBE; : BPF_FD_TYPE_KPROBE;
if (tk->symbol) {
*symbol = tk->symbol;
*probe_offset = tk->rp.kp.offset; *probe_offset = tk->rp.kp.offset;
*probe_addr = 0; *probe_addr = kallsyms_show_value(current_cred()) ?
} else { (unsigned long)tk->rp.kp.addr : 0;
*symbol = NULL; *symbol = tk->symbol;
*probe_offset = 0;
*probe_addr = (unsigned long)tk->rp.kp.addr;
}
return 0; return 0;
} }
#endif /* CONFIG_PERF_EVENTS */ #endif /* CONFIG_PERF_EVENTS */
......
...@@ -1415,7 +1415,7 @@ static void uretprobe_perf_func(struct trace_uprobe *tu, unsigned long func, ...@@ -1415,7 +1415,7 @@ static void uretprobe_perf_func(struct trace_uprobe *tu, unsigned long func,
int bpf_get_uprobe_info(const struct perf_event *event, u32 *fd_type, int bpf_get_uprobe_info(const struct perf_event *event, u32 *fd_type,
const char **filename, u64 *probe_offset, const char **filename, u64 *probe_offset,
bool perf_type_tracepoint) u64 *probe_addr, bool perf_type_tracepoint)
{ {
const char *pevent = trace_event_name(event->tp_event); const char *pevent = trace_event_name(event->tp_event);
const char *group = event->tp_event->class->system; const char *group = event->tp_event->class->system;
...@@ -1432,6 +1432,7 @@ int bpf_get_uprobe_info(const struct perf_event *event, u32 *fd_type, ...@@ -1432,6 +1432,7 @@ int bpf_get_uprobe_info(const struct perf_event *event, u32 *fd_type,
: BPF_FD_TYPE_UPROBE; : BPF_FD_TYPE_UPROBE;
*filename = tu->filename; *filename = tu->filename;
*probe_offset = tu->offset; *probe_offset = tu->offset;
*probe_addr = 0;
return 0; return 0;
} }
#endif /* CONFIG_PERF_EVENTS */ #endif /* CONFIG_PERF_EVENTS */
......
This diff is collapsed.
...@@ -46,7 +46,11 @@ void kernel_syms_load(struct dump_data *dd) ...@@ -46,7 +46,11 @@ void kernel_syms_load(struct dump_data *dd)
} }
dd->sym_mapping = tmp; dd->sym_mapping = tmp;
sym = &dd->sym_mapping[dd->sym_count]; sym = &dd->sym_mapping[dd->sym_count];
if (sscanf(buff, "%p %*c %s", &address, sym->name) != 2)
/* module is optional */
sym->module[0] = '\0';
/* trim the square brackets around the module name */
if (sscanf(buff, "%p %*c %s [%[^]]s", &address, sym->name, sym->module) < 2)
continue; continue;
sym->address = (unsigned long)address; sym->address = (unsigned long)address;
if (!strcmp(sym->name, "__bpf_call_base")) { if (!strcmp(sym->name, "__bpf_call_base")) {
......
...@@ -5,12 +5,14 @@ ...@@ -5,12 +5,14 @@
#define __BPF_TOOL_XLATED_DUMPER_H #define __BPF_TOOL_XLATED_DUMPER_H
#define SYM_MAX_NAME 256 #define SYM_MAX_NAME 256
#define MODULE_MAX_NAME 64
struct bpf_prog_linfo; struct bpf_prog_linfo;
struct kernel_sym { struct kernel_sym {
unsigned long address; unsigned long address;
char name[SYM_MAX_NAME]; char name[SYM_MAX_NAME];
char module[MODULE_MAX_NAME];
}; };
struct dump_data { struct dump_data {
......
...@@ -1057,6 +1057,16 @@ enum bpf_link_type { ...@@ -1057,6 +1057,16 @@ enum bpf_link_type {
MAX_BPF_LINK_TYPE, MAX_BPF_LINK_TYPE,
}; };
enum bpf_perf_event_type {
BPF_PERF_EVENT_UNSPEC = 0,
BPF_PERF_EVENT_UPROBE = 1,
BPF_PERF_EVENT_URETPROBE = 2,
BPF_PERF_EVENT_KPROBE = 3,
BPF_PERF_EVENT_KRETPROBE = 4,
BPF_PERF_EVENT_TRACEPOINT = 5,
BPF_PERF_EVENT_EVENT = 6,
};
/* cgroup-bpf attach flags used in BPF_PROG_ATTACH command /* cgroup-bpf attach flags used in BPF_PROG_ATTACH command
* *
* NONE(default): No further bpf programs allowed in the subtree. * NONE(default): No further bpf programs allowed in the subtree.
...@@ -6439,6 +6449,36 @@ struct bpf_link_info { ...@@ -6439,6 +6449,36 @@ struct bpf_link_info {
__s32 priority; __s32 priority;
__u32 flags; __u32 flags;
} netfilter; } netfilter;
struct {
__aligned_u64 addrs;
__u32 count; /* in/out: kprobe_multi function count */
__u32 flags;
} kprobe_multi;
struct {
__u32 type; /* enum bpf_perf_event_type */
__u32 :32;
union {
struct {
__aligned_u64 file_name; /* in/out */
__u32 name_len;
__u32 offset; /* offset from file_name */
} uprobe; /* BPF_PERF_EVENT_UPROBE, BPF_PERF_EVENT_URETPROBE */
struct {
__aligned_u64 func_name; /* in/out */
__u32 name_len;
__u32 offset; /* offset from func_name */
__u64 addr;
} kprobe; /* BPF_PERF_EVENT_KPROBE, BPF_PERF_EVENT_KRETPROBE */
struct {
__aligned_u64 tp_name; /* in/out */
__u32 name_len;
} tracepoint; /* BPF_PERF_EVENT_TRACEPOINT */
struct {
__u64 config;
__u32 type;
} event; /* BPF_PERF_EVENT_EVENT */
};
} perf_event;
}; };
} __attribute__((aligned(8))); } __attribute__((aligned(8)));
......
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