Re: [PATCH v2 bpf-next 2/6] selftests/bpf: Implement socket kfuncs for bpf_testmod

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 4/17/24 09:59, Jordan Rife wrote:
nit. Can "struct sockaddr_storage addr;" be directly used instead of a char array?
When using "struct sockaddr_storage addr;" directly, the BPF program
fails to load with the following error message.

libbpf: prog 'kernel_connect': BPF program load failed: Invalid argument
libbpf: prog 'kernel_connect': -- BEGIN PROG LOAD LOG --
0: R1=ctx() R10=fp0
; return bpf_kfunc_call_kernel_connect(args); @ sock_addr_kern.c:26
0: (85) call bpf_kfunc_call_kernel_connect#99994
arg#0 pointer type STRUCT addr_args must point to scalar, or struct with scalar
processed 1 insns (limit 1000000) max_states_per_insn 0 total_states 0 peak_states 0 mark_read 0
-- END PROG LOAD LOG --
libbpf: prog 'kernel_connect': failed to load: -22
libbpf: failed to load object 'sock_addr_kern'
libbpf: failed to load BPF skeleton 'sock_addr_kern': -22
load_sock_addr_kern:FAIL:skel unexpected error: -22
test_sock_addr:FAIL:load_sock_addr_kern unexpected error: -1 (errno 22)
#288 sock_addr:FAIL

I just looked into the definition of struct __kernel_sockaddr_sotrage
and the change log of this type. It has a pointer in it, causing this
error. According to the commit log, the pointer is there to fix an
alignment issue. I am curious if we can replace the pointer with
intptr_t to fix this error.

Of course, this should not block this patch set.




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux