Skip to content

bpftool no instructions returned #184

@vincentmli

Description

@vincentmli

Hi @qmonnet

I am trying to run bpftool to dump jited bpf program instructions according to
loxilb-io/loxilb#972 (comment), but I came across a strange problem that bpftool returns no instructions returned. the bpftool is built from kernel source after kernel is built, linux from scratch lfs build script for kernel and bpftool
https://github.com/vincentmli/BPFire/blob/bpfire/lfs/linux

	# Build bpftool
	cd $(DIR_APP)/tools/bpf/bpftool && sed -i -e 's/^prefix ?= \/usr\/local/prefix ?= \/usr/' Makefile
	cd $(DIR_APP)/tools/bpf/bpftool && make $(MAKETUNING)

part of build log

cd /usr/src/linux-6.14-rc5/tools/bpf/bpftool && sed -i -e 's/^prefix ?= \/usr\/local/prefix ?= \/usr/' Makefile
cd /usr/src/linux-6.14-rc5/tools/bpf/bpftool && make -j8
make[1]: Entering directory '/usr/src/linux-6.14-rc5/tools/bpf/bpftool'

Auto-detecting system features:
...                         clang-bpf-co-re: [ ^[[32mon^[[m  ]
...                                    llvm: [ ^[[32mon^[[m  ]
...                                  libcap: [ ^[[32mon^[[m  ]
...                                  libbfd: [ ^[[32mon^[[m  ]
...

  CLANG   pid_iter.bpf.o
  CLANG   profiler.bpf.o
  GEN     profiler.skel.h
  CC      prog.o
  GEN     pid_iter.skel.h
  CC      pids.o
  LINK    bpftool

bpftool version:

[root@loongfire ~]# bpftool -V
bpftool v7.6.0
using libbpf v1.6
features: llvm, skeletons

clang is version 18.1.0

background:

I was asked to dump jited loxilb bpf progrom instruction on loongfire OS which is loongarch CPU architecture port of open source firewall IPFire. https://lore.kernel.org/bpf/CAK3+h2woEjG_N=-XzqEGaAeCmgu2eTCUc7p6bP4u8Q+DFHm-7g@mail.gmail.com/T/#m5ca0884901df7512f20f0ca5b3d73ef89558471c. but then I found out that bpftool I built in IPFire can't dump any jited instruction for any bpf program, so I suspect something I might be missing when build bpftool from kernel source. this same issue happens to me for both loongarch and x86 architecture, so should be irrelevant to CPU architecture.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions