bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rafael David Tinoco <rafaeldtinoco@ubuntu.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>,
	Vamsi Kodavanty <vamsi@araalinetworks.com>,
	bpf <bpf@vger.kernel.org>
Subject: Re: [BPF CO-RE clarification] Use CO-RE on older kernel versions.
Date: Wed, 10 Mar 2021 19:45:32 -0300	[thread overview]
Message-ID: <7BEF1010-5D4A-4C6F-8059-BD18A4A9EA6F@ubuntu.com> (raw)
In-Reply-To: <CAEf4BzaPytBkMqDh15eLPskOj_+FQa0ta2G+BToEn1pSwMGpfA@mail.gmail.com>


> From what I see all the CO-RE relocations applied successfully (even
> though all the offsets stayed the same, so presumably you compiled
> your BPF program with vmlinux.h from the exact same kernel you are
> running it on?). Are you sure that vmlinux image you are providing
> corresponds to the actual kernel you are running on?

Yep, I have created the following:

https://pastebin.ubuntu.com/p/h58YyNr4HR/

to make this easier.

It is a 4.15.0-1080 kernel and a 4.15.18+. They are pretty close
despite the versioning (second was generated with make deb-dpkg).

I’m using same .config file for both, only difference is that the
4.15.18+ was compiled with the changed link-vmlinux.sh file.

The /usr/lib/debug/boot/vmlinux files are generated by the same
build and I have tried 2 or 3 of the existing packaged kernels. The
only thing I did was “pahole -J” to /usr/lib/debug/boot/vmlinux-XXX
files (adding the BTF section to them).

Running same binary in a 5.8.0-43 kernel works out-of-the-box:

https://pastebin.ubuntu.com/p/VKTjMcp6Xs/

>
> I'd start by comparing libbpf logs for vmlinux you get with modified
> link-vmlinux.sh script and with just explicit pahole -J. If all the
> CO-RE parts are identical, the problem is somewhere else most
> probably.

The difference between (1) and (2) from the paste (error and success):

libbpf: CO-RE relocating [0] struct task_struct: found target
candidate [17361] struct task_struct in [vmlinux]
libbpf: CO-RE relocating [0] struct task_struct: found target
candidate [17360] struct task_struct in [vmlinux]

libbpf: prog 'tcp_connect': relo #0: matching candidate #1 [17361]
struct task_struct.comm (0:90 @ offset 2640)
libbpf: prog 'tcp_connect': relo #0: matching candidate #1 [17360]
struct task_struct.comm (0:90 @ offset 2640)

Code is at:

https://github.com/rafaeldtinoco/portablebpf

and it is not much different than any other libbpf example.

thanks again for verifying this!

-rafaeldtinoco




  reply	other threads:[~2021-03-10 22:46 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-06 18:02 [BPF CO-RE clarification] Use CO-RE on older kernel versions Vamsi Kodavanty
2021-01-06 23:55 ` Andrii Nakryiko
2021-01-07 18:12   ` Vamsi Kodavanty
2021-01-07 18:52     ` Andrii Nakryiko
2021-01-07 22:45       ` Vamsi Kodavanty
2021-01-07 23:32         ` Andrii Nakryiko
2021-01-08  0:16           ` Vamsi Kodavanty
2021-01-08  1:31             ` Vamsi Kodavanty
2021-03-03 18:14               ` Rafael David Tinoco
2021-03-04  7:05                 ` Andrii Nakryiko
2021-03-04 13:10                   ` Arnaldo Carvalho de Melo
2021-03-05  6:32                   ` Rafael David Tinoco
     [not found]                     ` <67E3C788-2835-4793-8A9C-51C5D807C294@ubuntu.com>
2021-03-10  6:00                       ` Fwd: " Rafael David Tinoco
2021-03-10 19:19                       ` Andrii Nakryiko
2021-03-10 22:45                         ` Rafael David Tinoco [this message]
2021-03-12 18:36                           ` Andrii Nakryiko
2021-03-17  4:39                             ` Rafael David Tinoco
2021-03-17 14:31                               ` Rafael David Tinoco
2021-03-19  4:36                                 ` Andrii Nakryiko
2021-03-19  4:42                                   ` Rafael David Tinoco

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=7BEF1010-5D4A-4C6F-8059-BD18A4A9EA6F@ubuntu.com \
    --to=rafaeldtinoco@ubuntu.com \
    --cc=acme@redhat.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=vamsi@araalinetworks.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).