Here is an example: root@ubuntu1804hwe:~# uname -a Linux ubuntu1804hwe 5.4.0-47-generic #51~18.04.1-Ubuntu SMP Sat Sep 5 14:35:50 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux root@ubuntu1804hwe:~# cat test.c #include <linux/pkt_cls.h> #include <linux/bpf.h>
#ifndef __section # define __section(NAME) __attribute__((section(NAME), used)) #endif static int (*bpf_skb_change_head)(void *ctx, int headroom, int flags) = (void *) BPF_FUNC_skb_change_head; __section("test") int _test(struct __sk_buff *skb) { bpf_skb_change_head(skb, 14, 0); return TC_ACT_OK; } char _license[] __section("license") = "GPL"; root@ubuntu1804hwe:~# clang -target bpf -I/usr/include/x86_64-linux-gnu/ -O2 -o test.o -c test.c root@ubuntu1804hwe:~# ip link add name dummy1 type dummy root@ubuntu1804hwe:~# ip link set dummy1 up root@ubuntu1804hwe:~# tc qdisc add dev dummy1 clsact root@ubuntu1804hwe:~# tc filter add dev dummy1 egress matchall action bpf obj ./test.o sec test Prog section 'test' rejected: Invalid argument (22)! - Type: 4 - Instructions: 5 (0 over limit) - License: GPL Verifier analysis: 0: (b7) r2 = 14 1: (b7) r3 = 0 2: (85) call bpf_skb_change_head#43 unknown func bpf_skb_change_head#43 processed 3 insns (limit 1000000) max_states_per_insn 0 total_states 0 peak_states 0 mark_read 0 Error fetching program/map! bad action parsing parse_action: bad value (5:bpf)! Illegal "action" root@ubuntu1804hwe:~# -- You received this bug notification because you are a member of Kernel Packages, which is subscribed to linux in Ubuntu. https://bugs.launchpad.net/bugs/1896504 Title: tc/ebpf: unable to use BPF_FUNC_skb_change_head Status in linux package in Ubuntu: Incomplete Bug description: [Impact] tc ebpf program that uses BPF_FUNC_skb_change_head are rejected. This helper exists since linux v4.10, but it cannot be used until the the upstream commit 6f3f65d80dac ("net: bpf: Allow TC programs to call BPF_FUNC_skb_change_head"): https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6f3f65d80dac [Test Case] Create a, ebpf program that uses this helper and load it with tc. [Regression Potential] The patch is trivial, the potential regressions are low. To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1896504/+subscriptions -- Mailing list: https://launchpad.net/~kernel-packages Post to : kernel-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~kernel-packages More help : https://help.launchpad.net/ListHelp