BPF List
 help / color / mirror / Atom feed
From: Kui-Feng Lee <sinquersw@gmail.com>
To: Jason Ling <jasonling@google.com>, bpf@vger.kernel.org
Subject: Re: Is fentry/fexit support possible with an external BTF?
Date: Tue, 24 Jan 2023 10:26:00 -0800	[thread overview]
Message-ID: <296fcfac-9acd-9462-871c-b450fd140fa3@gmail.com> (raw)
In-Reply-To: <CAHBbfcUkr6fTm2X9GNsFNqV75fTG=aBQXFx_8Ayk+4hk7heB-g@mail.gmail.com>

On 1/23/23 16:21, Jason Ling wrote:
> Some context:
>
> The devices I am interested in have a small kernel partition (~16MB).
> Building the kernel with CONFIG_DEBUG_INFO_BTF=y increases the kernel
> size by about ~1.7M.
> So I've tried to use an external BTF (generating my own vmlinux BTF
> and placing it on a more spacious partition) but it seems like my
> eBPFs that attach to fexit hooks now fail loading. According to some
> comments in libbpf this seems to be expected.
>
> e.g an eBPF program that looks like this
>
> SEC("fexit/ksys_unshare")
> int BPF_PROG(handle_exit, unsigned long unshare_flags, int rv) {
> }
>
> fails the loading process.
>
>
> My guess is that there is additional debug/BTF information beyond what
> is available in vmlinux BTF that gets linked into vmlinuz and without
> this information the attaching to certain hooks fail.

IIRC, the verifier running in the kernel also needs BTF to verify the code.

That means you need a way to load BTF to kernel manually as well.


>
> So my question is:
>
> is there a way to achieve my goal of using a kernel that has been
> built with CONFIG_DEBUG_INFO_BTF=n and still be able to use
> fentry/fexit type hooks?

  reply	other threads:[~2023-01-24 18:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-24  0:21 Is fentry/fexit support possible with an external BTF? Jason Ling
2023-01-24 18:26 ` Kui-Feng Lee [this message]
2023-01-24 23:15   ` Alan Maguire
2023-01-24 23:17     ` Jason Ling

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=296fcfac-9acd-9462-871c-b450fd140fa3@gmail.com \
    --to=sinquersw@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=jasonling@google.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