bpf: allow CGROUP_SKB programs to use bpf_skb_cgroup_id() helper
Subsystems (3)
PATCH 1/1 bpf: allow CGROUP_SKB programs to use bpf_skb_cgroup_id() helper
Currently bpf_skb_cgroup_id() is not supported for CGROUP_SKB programs. An attempt to load such a program generates an error like this:
libbpf:
0: (b7) r6 = 0
...
9: (85) call bpf_skb_cgroup_id#79
unknown func bpf_skb_cgroup_id#79There are no particular reasons for denying it, and we have some use cases where it might be useful.
So let's add it to the list of allowed helpers.
--- net/core/filter.c | 4 ++++ 1 file changed, 4 insertions(+)
net/core/filter.c +4 -0
@@ -5919,6 +5919,10 @@ cg_skb_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)return &bpf_sk_storage_get_proto;case BPF_FUNC_sk_storage_delete:return &bpf_sk_storage_delete_proto; +#ifdef CONFIG_SOCK_CGROUP_DATA +case BPF_FUNC_skb_cgroup_id: +return &bpf_skb_cgroup_id_proto; +#endif #ifdef CONFIG_INET case BPF_FUNC_tcp_sock:return &bpf_tcp_sock_proto;
Signature · 1 line
2.20.1
Quoted 10 lines · Roman Gushchin
Currently
bpf_skb_cgroup_id()is not supported forCGROUP_SKBprograms. An attempt to load such a program generates an error like this:libbpf: 0: (b7) r6 = 0 ... 9: (85) call bpf_skb_cgroup_id#79 unknown func bpf_skb_cgroup_id#79
Quoted 4 lines
There are no particular reasons for denying it, and we have some use cases where it might be useful.
So let's add it to the list of allowed helpers.
Quoted 13 lines · Roman Gushchin
Currently
bpf_skb_cgroup_id()is not supported forCGROUP_SKBprograms. An attempt to load such a program generates an error like this:libbpf: 0: (b7) r6 = 0 ... 9: (85) call bpf_skb_cgroup_id#79 unknown func bpf_skb_cgroup_id#79There are no particular reasons for denying it, and we have some use cases where it might be useful.
Quoted 6 lines
So let's add it to the list of allowed helpers.
Signed-off-by Roman Gushchin <[email protected]>Cc Yonghong Song <[email protected]>Cc Alexei Starovoitov <[email protected]>Cc Daniel Borkmann <[email protected]>
Applied, thanks!
Quoted 14 lines · Daniel Borkmann
Quoted 13 lines · Roman Gushchin
Currently
bpf_skb_cgroup_id()is not supported forCGROUP_SKBprograms. An attempt to load such a program generates an error like this:libbpf: 0: (b7) r6 = 0 ... 9: (85) call bpf_skb_cgroup_id#79 unknown func bpf_skb_cgroup_id#79There are no particular reasons for denying it, and we have some use cases where it might be useful.
Quoted 8 lines
Quoted 6 lines
So let's add it to the list of allowed helpers.
Signed-off-by Roman Gushchin <[email protected]>Cc Yonghong Song <[email protected]>Cc Alexei Starovoitov <[email protected]>Cc Daniel Borkmann <[email protected]>Applied, thanks!
Thank you, Daniel!