On 01/07/2024 04:50, Totoro W wrote: > You're right Alan, with the above patch, the type name for the pointer > is gone, here's generated BTF the same program: > that's great (lucky guess on my part). It would be great to get that fixed in zig itself. That leaves the naming issues; from Eduard's mail: >> Even though this just work-around the issue, I'm still curious about >> the current naming sanitation, I want to know some background about >> it. > > Doing some git digging shows that name check was first introduced by > the following commit: > > 2667a2626f4d ("bpf: btf: Add BTF_KIND_FUNC and BTF_KIND_FUNC_PROTO") > > And lived like that afterwards. > > My guess is that kernel BTF is used to work with kernel functions and > data structures. All of which follow C naming convention. > >> If possible, could we relax this to accept more languages (like Zig) >> to write BPF programs? Thanks in advance. > > Could you please elaborate a bit? > Citation from [1]: > > Identifiers must start with an alphabetic character or underscore > and may be followed by any number of alphanumeric characters or > underscores. They must not overlap with any keywords. > > If a name that does not fit these requirements is needed, such as > for linking with external libraries, the @"" syntax may be used. > > Paragraph 1 matches C naming convention and should be accepted by > kernel/bpf/btf.c:btf_name_valid_identifier(). > Paragraph 2 is basically any string. > Which one do you want? > > [1] https://ziglang.org/documentation/master/#Identifiers > It looks like your workaround patch is dealing with FWDs and structs. The BTF you provided just seems to have namespaced names like [7] STRUCT 'map.Map.Def' size=24 vlen=3 These should work - at least since 9724160b3942 ("bpf/btf: Accept function names that contain dots") ...which landed in 6.4.rc4. If you're dealing with older kernels than that, you might need to work around the naming limitations, but for newer kernels these names should just work. Are there other issues you see aside from the presence of a '.' in a BTF struct/fwd name? Alan