BPF List
 help / color / mirror / Atom feed
From: Viktor Malik <vmalik@redhat.com>
To: David <david@davidv.dev>, bpf@vger.kernel.org
Cc: Alan Maguire <alan.maguire@oracle.com>
Subject: Re: Usage of kfuncs in tracepoints
Date: Tue, 13 Jan 2026 09:05:39 +0100	[thread overview]
Message-ID: <793831f1-a8ea-4e0b-a0e8-c86c30b1ab2f@redhat.com> (raw)
In-Reply-To: <bb6a3ada-ddcf-417d-82c7-f86cde6ed4f7@davidv.dev>

On 1/12/26 20:08, David wrote:
> On 12/01/2026 19:03, Alan Maguire wrote:
> 
>> I think you need to add "__ksym __weak";" here i.e.
> 
> This change let me load the program, however, libbpf cannot find a 
> kernel image at
> /sys/kernel/btf/vmlinux, because /sys/kernel/btf is not populated on my 
> system.
> 
> My kernel _is_ built with CONFIG_DEBUG_INFO_BTF=y, is there something 
> else I need to do
>   to get this path populated?

Did you try rebuilding from scratch (with `make clean`) after enabling
CONFIG_DEBUG_INFO_BTF? If the sources were already built without debug
info, they will not be automatically rebuilt just by adding the config
option.

> 
> Because this path is missing, libbpf reports:
> 
> ```
> kernel BTF is missing at '/sys/kernel/btf/vmlinux', was 
> CONFIG_DEBUG_INFO_BTF enabled?
> ```
> 
> But I see from strace that it tries a few fallback paths.
> In the meantime, I copied my kernel into /boot/vmlinux-6.18.2 so libbpf 
> can find it, but
> now the loader says
> 
> ```
> calling kernel function is not supported without CONFIG_DEBUG_INFO_BTF
> ```

While libbpf may try other fallback paths to find BTF, using kfuncs
requires the kernel to find that kfunc in BTF and kernel will only use
the system BTF (the one from /sys/kernel/vmlinux/btf).

> Can I not use `bpf_strstr` on a tracepoint? To validate, I tried a 
> `raw_tp` but
> had the same result.

There shouldn't be any issue using bpf_strstr from tracepoints (or any
other program type).

Viktor


  reply	other threads:[~2026-01-13  8:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-12 16:57 Usage of kfuncs in tracepoints David
2026-01-12 18:03 ` Alan Maguire
2026-01-12 19:08   ` David
2026-01-13  8:05     ` Viktor Malik [this message]
2026-01-13 11:53       ` David
2026-01-13 12:08         ` Jiri Olsa
2026-01-13 13:58           ` David

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=793831f1-a8ea-4e0b-a0e8-c86c30b1ab2f@redhat.com \
    --to=vmalik@redhat.com \
    --cc=alan.maguire@oracle.com \
    --cc=bpf@vger.kernel.org \
    --cc=david@davidv.dev \
    /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