bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rafael David Tinoco <rafaeldtinoco@ubuntu.com>
To: vamsi@araalinetworks.com
Cc: andrii.nakryiko@gmail.com, rafaeldtinoco@gmail.com, bpf@vger.kernel.org
Subject: Re: [BPF CO-RE clarification] Use CO-RE on older kernel versions.
Date: Wed,  3 Mar 2021 15:14:57 -0300	[thread overview]
Message-ID: <20210303181457.172434-1-rafaeldtinoco@ubuntu.com> (raw)
In-Reply-To: <CADmGQ+0dDjfs6UL63m3vLAfu+GHgSFdMO+Rmz_jk+0R9Wva2Tw@mail.gmail.com>

> > From:   Vamsi Kodavanty <vamsi@araalinetworks.com>
> > Date:   Thu, 7 Jan 2021 17:31:11 -0800
> > To:     Andrii Nakryiko <andrii.nakryiko@gmail.com>
> > Cc:     bpf <bpf@vger.kernel.org>
> >
> >
> > Right. Libbpf only supports a newer and safer way to attach to
> > kprobes. For your experiments, try to stick to tracepoints and you'll
> > have a better time.
> >
> > But it's another thing I've been meaning to add to libbpf for
> > supporting older kernels. I even have code written to do legacy kprobe
> > attachment, just need to find time to send a patch to add it as a
> > fallback for kernels that don't support new kprobe interface.

Initially I'd like to thank you *a lot* for this thread, it helped me
creating:

https://github.com/rafaeldtinoco/portablebpf

showing up exactly what was discussed here AND I could run the same
binary in v4.15 and v.5.8 kernels as long as BTF was generated with:

https://github.com/rafaeldtinoco/portablebpf/blob/master/patches/link-vmlinux.sh.patch

Specially the attach_kprobe_legacy() function:

https://github.com/rafaeldtinoco/portablebpf/blob/master/mine.c#L31

I wanted to reply here in case others also face this.

Only bad thing was kernel v4.15 missed global data support as showed in:

https://github.com/iovisor/bcc/blob/master/docs/kernel-versions.md

But using perf event was good enough for an example.

- rafaeldtinoco

  reply	other threads:[~2021-03-03 22:57 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 [this message]
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
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=20210303181457.172434-1-rafaeldtinoco@ubuntu.com \
    --to=rafaeldtinoco@ubuntu.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=rafaeldtinoco@gmail.com \
    --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).