On 8/1/23 2:59 PM, Ivan Babrou wrote:
I noticed that bpf_sk_cgroup_id is not available in a tracepoint (it is only available in cgroup related skb filters), even though I can easily do what it does manually: u64 cgroup_id = sk->sk_cgrp_data.cgroup->kn->id; It seems to me that bpf_sk_cgroup_id and similar functions should be added to bpf_base_func_proto (unless there's a better place).
This will make it available to all tracing progs. How to ensure doing 'sk->sk_cgrp_data.cgroup->kn->id' is safe in all traceable context? so please don't do that.
bpf will handle the exception when the bpf prog reads 'sk->...' (eg. in case sk is an invalid ptr), so please keep using it for tracing programs.