bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Lau <kafai@fb.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: bpf <bpf@vger.kernel.org>, Networking <netdev@vger.kernel.org>,
	"Alexei Starovoitov" <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	"David Miller" <davem@davemloft.net>,
	Kernel Team <Kernel-team@fb.com>
Subject: Re: [PATCH v3 bpf-next 3/3] bpf: Add cb access in kfree_skb test
Date: Thu, 7 Nov 2019 17:29:14 +0000	[thread overview]
Message-ID: <20191107172911.7sg3xpezln6hoq3n@kafai-mbp> (raw)
In-Reply-To: <CAEf4BzY6aDYKUGv2D-xy2bQKuH6zeMGvqA5p74xjcUXKq5KDZA@mail.gmail.com>

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@fb.com> wrote:
> >
> > Access the skb->cb[] in the kfree_skb test.
> >
> > Signed-off-by: Martin KaFai Lau <kafai@fb.com>
> > ---
> 
> Acked-by: Andrii Nakryiko <andriin@fb.com>
> 
> >  .../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;
> >
> 
> [...]

      reply	other threads:[~2019-11-07 17:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-07  1:46 [PATCH v3 bpf-next 0/3] bpf: Add array support to btf_struct_access Martin KaFai Lau
2019-11-07  1:46 ` [PATCH v3 bpf-next 1/3] bpf: Account for insn->off when doing bpf_probe_read_kernel Martin KaFai Lau
2019-11-07  2:45   ` Andrii Nakryiko
2019-11-07  5:57   ` Alexei Starovoitov
2019-11-07  1:46 ` [PATCH v3 bpf-next 2/3] bpf: Add array support to btf_struct_access Martin KaFai Lau
2019-11-07  2:41   ` Andrii Nakryiko
2019-11-07 17:22     ` Martin Lau
2019-11-07 17:26       ` Andrii Nakryiko
2019-11-07  1:46 ` [PATCH v3 bpf-next 3/3] bpf: Add cb access in kfree_skb test Martin KaFai Lau
2019-11-07  2:50   ` Andrii Nakryiko
2019-11-07 17:29     ` Martin Lau [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191107172911.7sg3xpezln6hoq3n@kafai-mbp \
    --to=kafai@fb.com \
    --cc=Kernel-team@fb.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).