On Tue, Sep 01, 2020 at 11:32:06AM +0100, Lorenz Bauer wrote: > * Can we teach the verifier that PTR_TO_BTF_ID can be the same as PTR_TO_SOCKET? I am working on a patch to teach the verifier to allow PTR_TO_SOCK* being used in the bpf_skc_to_*_sock() helper. The use case is, for example, use bpf_skc_to_tcp_sock() to cast the tc's __sk_buff->sk to a kernel "struct tcp_sock" (PTR_TO_BTF_ID) such that the bpf prog won't be limited by the fields in "struct bpf_tcp_sock" if the user has perfmon cap. Thus, in general, should be doable. Hopefully I have something sharable next week. For the sockmap iter (which is tracing), I think it is better to begin with PTR_TO_BTF_ID_OR_NULL such that the bpf iter prog can access the tcp_sock (or udp_sock) without another casting or bpf_probe_read_kernel().