bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Tal Lossos <tallossos@gmail.com>
Cc: bpf <bpf@vger.kernel.org>, Andrii Nakryiko <andrii@kernel.org>,
	assaf.shab@gmail.com
Subject: Re: Question regarding "BPF CO-RE reference guide" blog post
Date: Mon, 25 Oct 2021 12:20:23 -0700	[thread overview]
Message-ID: <CAEf4Bzbkvb3YN+ZkWdZFw1=Uv-c1Gnsv+KoTtLMUUPnV15zZ=A@mail.gmail.com> (raw)
In-Reply-To: <CAO15rP=JzzanBC7Hj=9pshpMeWGJVpbt0wCiZfP8HwBaEbcFMw@mail.gmail.com>

On Mon, Oct 25, 2021 at 5:06 AM Tal Lossos <tallossos@gmail.com> wrote:
>
> Hello!
> After reading Andrii's new blog post regarding BPF CO-RE, which was
> really lovely and well written, I came up with a small question:
> When you gave the example for BPF_CORE_READ, you've accessed the
> executable pointer under linux_binfmt struct.
> Is it a mistake with linux_binprm struct? or maybe I'm missing something.

Yeah, totally a mistake, sorry. I've fixed it. It should be
t->mm->exe_file->fpath.dentry->d_name.name (one pointer dereference
step shorter). Thanks for reading carefully and reporting the problem!

>
> Another thing, maybe you could add a little explanation about how
> libbpf validates the structs offsets with the help of BTF? It's a key
> part of CO-RE so it would be nice to have a little deep-dive in the
> blog post about it :)

This felt like repeating some low-level things from previous blog
posts and describing BTF rather than CO-RE mechanics itself. This
topic was described in previous BPF CO-RE post in more detail ([0]),
BTF itself was described (along the dedup algo) in [1]. CO-RE
relocation format I don't think I've ever described in detail, but
this comment ([2]) in libbpf source code should give you a pretty good
idea, I hope.

  [0] https://nakryiko.com/posts/bpf-portability-and-co-re/#compiler-support
  [1] https://nakryiko.com/posts/btf-dedup/#bpf-and-type-information
  [2] https://github.com/libbpf/libbpf/blob/master/src/relo_core.h#L25-L70

>
> Thanks.

      reply	other threads:[~2021-10-25 19:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-25 12:05 Question regarding "BPF CO-RE reference guide" blog post Tal Lossos
2021-10-25 19:20 ` Andrii Nakryiko [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='CAEf4Bzbkvb3YN+ZkWdZFw1=Uv-c1Gnsv+KoTtLMUUPnV15zZ=A@mail.gmail.com' \
    --to=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=assaf.shab@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=tallossos@gmail.com \
    /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).