Skip to content

Commit

Permalink
lunatik: missing module BTF kfuncs not regstered
Browse files Browse the repository at this point in the history
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 #40
see luainkernel/lunatik#189

Signed-off-by: Vincent Li <[email protected]>
  • Loading branch information
vincentmli committed Sep 17, 2024
1 parent cacf5f2 commit 6723112
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 4 additions & 1 deletion lfs/linux
Original file line number Diff line number Diff line change
Expand Up @@ -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" \
Expand Down
3 changes: 1 addition & 2 deletions lfs/lunatik
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ objects = $(DL_FILE)

$(DL_FILE) = $(DL_FROM)/$(DL_FILE)

$(DL_FILE)_BLAKE2 = 96bee0f721e4098cf8523134a325290272cc4e99583bbdd775594b1ff38119e8cafa431987e570994dc69f2a45c2a78d298029eb29da457401e2c5993a0edb6f
$(DL_FILE)_BLAKE2 = 318a0dc1220ff052aa0f56bf0e36783368b94b48d3a994283f3e6ca6326301b657917f7f8acc27c42e65d136dcf9f2f5f39f1b9de263aeaf831d2457f781c6d0

install : $(TARGET)

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6723112

Please sign in to comment.