mozillazg / ptcpdump

Process-aware, eBPF-based tcpdump
MIT License
620 stars 43 forks source link

load program failed: invalid argument arg#0 type is not a struct #89

Closed dcw4code closed 4 months ago

dcw4code commented 4 months ago

./ptcpdump -i any Failed on centos based OS, linux kernel version: 5.4.241 but works on ubuntu server 24.04

FATAL cmd/log.go:16] Verifier error: load program: invalid argument:
        func#0 @0
        arg#0 type is not a struct
        Unrecognized arg#0 type PTR
        0: R1=ctx(id=0,off=0,imm=0) R10=fp0
        ; u64 cookie = bpf_get_socket_cookie(ctx);
        0: (85) call bpf_get_socket_cookie#46
        1: R0_w=inv(id=0) R10=fp0
        ; u64 cookie = bpf_get_socket_cookie(ctx);
        1: (7b) *(u64 *)(r10 -24) = r0
        2: R0_w=inv(id=0) R10=fp0 fp-24_w=mmmmmmmm
        ; if (cookie <= 0) {
        2: (15) if r0 == 0x0 goto pc+529
         R0_w=inv(id=0) R10=fp0 fp-24_w=mmmmmmmm
        3: R0_w=inv(id=0) R10=fp0 fp-24_w=mmmmmmmm
        ; struct task_struct *task = (struct task_struct *)bpf_get_current_task();
        3: (85) call bpf_get_current_task#35
        unknown func bpf_get_current_task#35
        processed 4 insns (limit 1000000) max_states_per_insn 0 total_states 0 peak_states 0 mark_read 0
mozillazg commented 4 months ago

Thanks for reporting. I will take a look into it. What distro version are you using? Cloud you provide the output of uname -a?

dcw4code commented 4 months ago

5.4.241-1-tlinux4-0017.10 腾讯云主机

mozillazg commented 4 months ago

@dcw4code The latest version already improved compatibility with the OpenCloudOS 7/8/9 and TencentOS Server 2.4/3.1. Please try again.

dcw4code commented 4 months ago

Works fine on TencentOS Server 2.6 and 3.2 666~