On Wed, Nov 06, 2019 at 06:50:02PM -0800, Andrii Nakryiko wrote: > On Wed, Nov 6, 2019 at 5:47 PM Martin KaFai Lau <kafai@xxxxxx> wrote: > > > > Access the skb->cb[] in the kfree_skb test. > > > > Signed-off-by: Martin KaFai Lau <kafai@xxxxxx> > > --- > > Acked-by: Andrii Nakryiko <andriin@xxxxxx> > > > .../selftests/bpf/prog_tests/kfree_skb.c | 54 +++++++++++++++---- > > tools/testing/selftests/bpf/progs/kfree_skb.c | 25 +++++++-- > > 2 files changed, 63 insertions(+), 16 deletions(-) > > > > [...] > > > > > + meta.ifindex = _(dev->ifindex); I hit this when I put "meta.ifindex = dev->ifindex;" inside __builtin_preserve_access_index: libbpf: prog 'tp_btf/kfree_skb': relo #0: no matching targets found for [13] meta + 0:0 libbpf: prog 'tp_btf/kfree_skb': relo #0: failed to relocate: -3 libbpf: failed to perform CO-RE relocations: -3 My blind guess was it thought meta has to be relocated too. Hence, I moved it out such that I can put __builtin_preserve_access_index only to "dev->ifindex". > > + meta.cb8_0 = cb8[8]; > > + meta.cb32_0 = cb32[2]; These two do not need relo. > > Have you tried doing it inside __builtin_preserve_access_index region? > Does it fail because of extra allocations against meta? > > > + > > bpf_probe_read_kernel(&pkt_type, sizeof(pkt_type), _(&skb->__pkt_type_offset)); > > pkt_type &= 7; > > > > [...]