diff options
author | Toke Høiland-Jørgensen <toke@redhat.com> | 2021-04-13 11:16:06 +0200 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2021-04-13 18:18:57 -0700 |
commit | 441e8c66b23e027c00ccebd70df9fd933918eefe (patch) | |
tree | a63bbd06a0039e18a5a8f2c972c16e9d47e46f2b /include/linux/bpf_verifier.h | |
parent | db16c1fe92d7ba7d39061faef897842baee2c887 (diff) | |
download | linux-441e8c66b23e027c00ccebd70df9fd933918eefe.tar.gz linux-441e8c66b23e027c00ccebd70df9fd933918eefe.tar.bz2 linux-441e8c66b23e027c00ccebd70df9fd933918eefe.zip |
bpf: Return target info when a tracing bpf_link is queried
There is currently no way to discover the target of a tracing program
attachment after the fact. Add this information to bpf_link_info and return
it when querying the bpf_link fd.
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20210413091607.58945-1-toke@redhat.com
Diffstat (limited to 'include/linux/bpf_verifier.h')
-rw-r--r-- | include/linux/bpf_verifier.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h index 51c2ffa3d901..6023a1367853 100644 --- a/include/linux/bpf_verifier.h +++ b/include/linux/bpf_verifier.h @@ -487,6 +487,15 @@ static inline u64 bpf_trampoline_compute_key(const struct bpf_prog *tgt_prog, return ((u64)btf_obj_id(btf) << 32) | 0x80000000 | btf_id; } +/* unpack the IDs from the key as constructed above */ +static inline void bpf_trampoline_unpack_key(u64 key, u32 *obj_id, u32 *btf_id) +{ + if (obj_id) + *obj_id = key >> 32; + if (btf_id) + *btf_id = key & 0x7FFFFFFF; +} + int bpf_check_attach_target(struct bpf_verifier_log *log, const struct bpf_prog *prog, const struct bpf_prog *tgt_prog, |