Re: [PATCH bpf-next v9 3/9] bpf: Add bpf_sock_addr_set_unix_addr() to allow writing unix sockaddr from bpf

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

 



From: Martin KaFai Lau <martin.lau@xxxxxxxxx>
Date: Tue, 10 Oct 2023 13:07:54 -0700
> On 10/10/23 10:00 AM, Kuniyuki Iwashima wrote:
> >> +__bpf_kfunc int bpf_sock_addr_set_unix_addr(struct bpf_sock_addr_kern *sa_kern,
> >> +					    const u8 *addr, u32 addrlen__sz)
> > I'd rename addrlen__sz to sun_path_len or something else because the
> > conventional addrlen for AF_UNIX contains offsetof(struct sockaddr_un,
> > sun_path).
> 
> The "__sz" suffix is required by the verifier. It is the size of the preceding 
> argument "addr". While at it, addrlen__sz should be just "addr__sz" (or 
> sun_path__sz, depending on what name is decided here) for consistency with other 
> kfunc.

I didn't know that, thank you!


> 
> I don't have strong preference on the argument name. However, if it is 
> sun_path__sz, then the preceding argument should be renamed to "sun_path" also 
> for consistency reason and then the kfunc should probably be renamed to 
> bpf_sock_addr_set_sun_path.

I prefer sun_path, sun_path__sz, and bpf_sock_addr_set_sun_path() that are
clearer and consistent with uAPI, sockaddr_un.sun_path.




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux