lunatik: missing module BTF kfuncs not regstered

error when run lunatik which loads lunatik kernel modules

root@bpfire-2 lua]# lunatik run examples/filter/sni false

[root@bpfire-2 lua]# dmesg

[  330.411665] lunatik: loading out-of-tree module taints kernel.
[  330.411680] lunatik: module verification failed: signature and/or required key missing - tainting kernel
[  330.433955] Kernel module BTF mismatch detected, BTF debug info may be unavailable for some modules
[  330.767701] missing module BTF, cannot register kfuncs

BPFire chroot build mount /sys/kernel/btf/vmlinux which is
the host binary vmlinux BTF to build against lunatik kernel module,
which result in above error. adjust BPFire kernel build to save
the binary vmlinux BTF to chroot
/lib/modules/6.6.15-ipfire/build/vmlinux for lunatik kernel module.

create the vmlinux.h from the same binary vmlinux BTF for the ebpf https.o

lunatik kernel module is depending on kernel build, adjust the lunatik
build accordingly when kerne upgrade in future.

See https://github.com/vincentmli/BPFire/issues/40
see https://github.com/luainkernel/lunatik/issues/189

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
This commit is contained in:
Vincent Li
2024-09-17 17:22:22 +00:00
parent cacf5f209d
commit 6723112498
2 changed files with 5 additions and 3 deletions

View File

@@ -230,8 +230,11 @@ endif
/lib/modules/$(VER)-$(VERSUFIX)/build/autoconf.h
cp /lib/modules/$(VER)-$(VERSUFIX)/build/.config \
/lib/modules/$(VER)-$(VERSUFIX)/build/include/config/auto.conf
# for lunatik: copy resolve_btfids to /lib/modules/$(VER)-$(VERSUFIX)/build/tools/bpf/resolve_btfids/
# lunatik: copy resolve_btfids to /lib/modules/$(VER)-$(VERSUFIX)/build/tools/bpf/resolve_btfids/
# cop.btf.vmlinux.bin.o to vmlinux for lunatik kernel modules build
cp -f $(DIR_APP)/tools/bpf/resolve_btfids/resolve_btfids /lib/modules/$(VER)-$(VERSUFIX)/build/tools/bpf/resolve_btfids/
cp -f $(DIR_APP)/.btf.vmlinux.bin.o /lib/modules/$(VER)-$(VERSUFIX)/build/vmlinux
# Fix permissions
find /lib/modules/$(VER)-$(VERSUFIX) -name "modules.order" \

View File

@@ -41,7 +41,7 @@ objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
$(DL_FILE)_BLAKE2 = 96bee0f721e4098cf8523134a325290272cc4e99583bbdd775594b1ff38119e8cafa431987e570994dc69f2a45c2a78d298029eb29da457401e2c5993a0edb6f
$(DL_FILE)_BLAKE2 = 318a0dc1220ff052aa0f56bf0e36783368b94b48d3a994283f3e6ca6326301b657917f7f8acc27c42e65d136dcf9f2f5f39f1b9de263aeaf831d2457f781c6d0
install : $(TARGET)
@@ -74,7 +74,6 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
#generate lunatik symbols before build
cd $(DIR_APP) && ./gensymbols.sh lua/lua.h lua/lauxlib.h lua/lualib.h > lunatik_sym.h
cd $(DIR_APP) && make btf_install
cd $(DIR_APP) && make
cd $(DIR_APP) && make install
cd $(DIR_APP)/examples/filter && make