falcosecurity / libs

libsinsp, libscap, the kernel module driver, and the eBPF driver sources
https://falcosecurity.github.io/libs/
Apache License 2.0
212 stars 158 forks source link

[FEATURE/BUG] Bpf module test failed on loongarch #1850

Open yzewei opened 1 month ago

yzewei commented 1 month ago

Describe the bug ERROR:

-----------------------------------------------------
- Setup phase
-----------------------------------------------------

* Configure BPF probe tests! Probe path: /home/yzw/rd/libs/build/driver/bpf/probe.o
* Using buffer dim: 8388608
-- BEGIN PROG LOAD LOG --
0: R1=ctx() R10=fp0
0: (85) call bpf_get_smp_processor_id#8       ; R0_w=scalar(smin=smin32=0,smax=umax=smax32=umax32=7,var_off=(0x0; 0x7))
1: (63) *(u32 *)(r10 -4) = r0         ; R0_w=scalar(smin=smin32=0,smax=umax=smax32=umax32=7,var_off=(0x0; 0x7)) R10=fp0 fp-8=mmmm????
2: (bf) r2 = r10                      ; R2_w=fp0 R10=fp0
3: (07) r2 += -4                      ; R2_w=fp-4
4: (18) r1 = 0x900000059f745800       ; R1_w=map_ptr(ks=4,vs=201)
6: (85) call bpf_map_lookup_elem#1    ; R0_w=map_value_or_null(id=1,ks=4,vs=201)
7: (18) r1 = 0x9000000135452e00       ; R1=map_ptr(ks=4,vs=4)
9: (15) if r0 == 0x0 goto pc+2        ; R0=map_value(ks=4,vs=201)
10: (18) r1 = 0x9000000135452e00      ; R1_w=map_ptr(ks=4,vs=4)
12: (61) r2 = *(u32 *)(r1 +0)
cannot access ptr member ops with moff 0 in struct bpf_map with off 0 size 4
processed 10 insns (limit 1000000) max_states_per_insn 0 total_states 1 peak_states 1 mark_read 1

-- END PROG LOAD LOG --
Unable to open the engine: libscap: bpf_load_program() event=tracepoint/filler/terminate_filler: Operation not permitted

How to reproduce it

cmake -DUSE_BUNDLED_DEPS=On -DENABLE_DRIVERS_TESTS=On -DBUILD_LIBSCAP_GVISOR=Off -DBUILD_BPF=On -DBUILD_LIBSCAP_MODERN_BPF=On -DCREATE_TEST_TARGETS=On -DMODERN_BPF_DEBUG_MODE=On ..
make drivers_test
make bpf
sudo ./test/drivers/drivers_test -b

Environment

yzewei commented 1 month ago

@FedeDP @Andreagit97

FedeDP commented 1 month ago

Hi @yzewei ! it seems you are hitting a verifier issue; are you using libs from master?

FedeDP commented 1 month ago

/milestone TBD

yzewei commented 1 month ago

Hi @yzewei ! it seems you are hitting a verifier issue; are you using libs from master?

@FedeDP Currently using the 0.14.3 branch, ready to use the master branch to try.

FedeDP commented 1 month ago

Yes it would be great, thanks!