On Fri, Apr 10, 2020 at 03:57:39PM -0700, Andrey Ignatov wrote: > > > Seems like kernels accept expected_attach_type > > for a while now, so it might be ok backwards compatibility-wise? > > Sure, that commit is from 2018, but I guess backward compatibility > should still be maintained in this case? That's a question to > maintainers though. If simply changing BPF_APROG_SEC to BPF_EAPROG_SEC > is an option that works for me. > > > > Otherwise, we can teach libbpf to retry program load without expected > > attach type for cgroup_skb/egress? > > Looks like a lot of work compared to simply adding a new section name > (or changing existing section if backward compatibility is not a concern > here). I still don't understand that backward compatiblity concern. Fixing libbpf to do BPF_EAPROG_SEC("cgroup_skb/egress" will make egress progs to fail at load time if they use > 1 return value on old kernels and fail at load time for > 3 return value on new kernels. Without libbpf fix such progs would rely on old and new kernels internal implementation details. Since on the latest kernel with current libbpf behavior the egress prog will get loaded as ingress type with return value 4 and then gets attached at egress. Argh. One really need to deep dive into kernel sources to figure out what kernel will do with such return value. Such behavior is undefined and broken. Did I misunderstand the whole issue?