On Tue, Feb 23, 2021 at 3:15 PM Ilya Leoshkevich <iii@xxxxxxxxxxxxx> wrote: > > The logic follows that of BTF_KIND_INT most of the time. Sanitization > replaces BTF_KIND_FLOATs with equally-sized empty BTF_KIND_STRUCTs on > older kernels, for example, the following: > > [4] FLOAT 'float' size=4 > > becomes the following: > > [4] STRUCT '(anon)' size=4 vlen=0 > > Signed-off-by: Ilya Leoshkevich <iii@xxxxxxxxxxxxx> > --- Acked-by: Andrii Nakryiko <andrii@xxxxxxxxxx> > tools/lib/bpf/btf.c | 51 ++++++++++++++++++++++++++++++++- > tools/lib/bpf/btf.h | 6 ++++ > tools/lib/bpf/btf_dump.c | 4 +++ > tools/lib/bpf/libbpf.c | 26 ++++++++++++++++- > tools/lib/bpf/libbpf.map | 5 ++++ > tools/lib/bpf/libbpf_internal.h | 2 ++ > 6 files changed, 92 insertions(+), 2 deletions(-) > [...] > /* it's completely legal to append BTF types with type IDs pointing forward to > * types that haven't been appended yet, so we only make sure that id looks > * sane, we can't guarantee that ID will always be valid > @@ -1910,7 +1955,7 @@ static int btf_add_composite(struct btf *btf, int kind, const char *name, __u32 > * - *byte_sz* - size of the struct, in bytes; > * > * Struct initially has no fields in it. Fields can be added by > - * btf__add_field() right after btf__add_struct() succeeds. > + * btf__add_field() right after btf__add_struct() succeeds. Was there some whitespacing problem on this line? > * > * Returns: > * - >0, type ID of newly added BTF type; [...]