public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Quentin Monnet <qmo@kernel.org>
To: Farbod Shahinfar <fshahinfar1@gmail.com>, bpf@vger.kernel.org
Subject: Re: bpftool generated jited has unpreventable jump addresses
Date: Mon, 9 Mar 2026 17:25:42 +0000	[thread overview]
Message-ID: <f7be55c8-be47-490f-8afd-65cfaa95fbfe@kernel.org> (raw)
In-Reply-To: <CA+WLDByd8qeUpVBijKooyZkBRB1iwGT8fjUEUKXgQEFAZ_pzHA@mail.gmail.com>

2026-03-05 14:54 UTC+0100 ~ Farbod Shahinfar <fshahinfar1@gmail.com>
> Hi,
> 
> I want to prepare a CFG for a jited eBPF program. The output of
> `bpftool prog dump jited id xx` reports jumps with kernel memory
> address (e.g., `ja      0xffffffffc013ad2a`) and it seems impossible
> to infer where the destination of the jump is. I thought maybe by
> knowing the base address of the program, I can manually convert jump
> destinations to relative addresses, but the base address is not known
> by bpftool (As far as I understood looking at the code).


Hi, if I remember correctly you may be able to get the base address for
the image from /proc/kallsyms, depending on your privileges and your
sysctl configuration, see:

https://docs.kernel.org/admin-guide/sysctl/net.html#bpf-jit-kallsyms


> My questions are:
> 1. Is this a real problem or am I missing something (I might be
> because the bpftool already reports CFG for xlated version)


As far as I'm aware, there hasn't been much interest so far in
generating the CFG for the JITed program, knowing that it's already
available for xlated instructions indeed.


> 2. If it is a limitation, how do you suggest to address the problem
> (if it is of interest to others of course). My initial guess is to
> return the load address of the program in the `bpf_prog_info` when
> doing `bpf_prog_get_info_by_fd`


If the sysctl knob is turned off, I'm not sure allowing the extraction
of image addresses through bpftool is a good idea.

Quentin

  reply	other threads:[~2026-03-09 17:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-05 13:54 bpftool generated jited has unpreventable jump addresses Farbod Shahinfar
2026-03-09 17:25 ` Quentin Monnet [this message]
2026-03-12 10:53   ` Farbod Shahinfar

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=f7be55c8-be47-490f-8afd-65cfaa95fbfe@kernel.org \
    --to=qmo@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=fshahinfar1@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