mirror of
https://github.com/netdata/libbpf.git
synced 2026-11-05 17:30:15 +08:00
bpf: Add support to specify uprobe_multi target via file descriptor
Allow uprobe_multi link to identify the target binary by an already opened file descriptor. Adding new BPF_F_UPROBE_MULTI_PATH_FD flag and the path_fd field for the attr.link_create.uprobe_multi struct. When the flag is set, we resolve the target from path_fd, without the flag, we keep the existing string path behavior. I don't see a use case for supporting O_PATH file descriptors, because we need to read the binary first to get probes offsets, so I'm using the CLASS(fd, f), which fails for O_PATH fds. Assisted-by: Codex:GPT-5.4 Signed-off-by: Jiri Olsa <jolsa@kernel.org> Link: https://lore.kernel.org/r/20260611114230.950379-4-jolsa@kernel.org Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
1 parent
b6c0d2c595
commit
82d3303c39
1 file changed
+6
-1
@@ -1327,7 +1327,11 @@ enum {
|
||||
* BPF_TRACE_UPROBE_MULTI attach type to create return probe.
|
||||
*/
|
||||
enum {
|
||||
BPF_F_UPROBE_MULTI_RETURN = (1U << 0)
|
||||
/* Get return uprobe. */
|
||||
BPF_F_UPROBE_MULTI_RETURN = (1U << 0),
|
||||
|
||||
/* Get path from provided path_fd. */
|
||||
BPF_F_UPROBE_MULTI_PATH_FD = (1U << 1),
|
||||
};
|
||||
|
||||
/* link_create.netfilter.flags used in LINK_CREATE command for
|
||||
@@ -1864,6 +1868,7 @@ union bpf_attr {
|
||||
__u32 cnt;
|
||||
__u32 flags;
|
||||
__u32 pid;
|
||||
__u32 path_fd;
|
||||
} uprobe_multi;
|
||||
struct {
|
||||
union {
|
||||
|
||||
Reference in new issue
Block a user