Re: [PATCH bpf-next 0/5] BTF: arbitrary __attribute__ encoding

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

 



On Wednesday, January 22nd, 2025 at 11:47 AM, Jose E. Marchesi <jose.marchesi@xxxxxxxxxx> wrote:

> [...]
> > 
> > Using the contents of the tag to indicate it's meaning (such as
> > "cattrubite:always_inline") will work too. However I don't think it's
> > desirable to have to parse the tag strings within libbpf, even more so
> > in BPF verifier.
> 
> 
> I expect the verifier will in any case have to distinguish the different
> strings it gets in the tags, for other purposes, right, so this wouldn't
> be introducing anything different?

I only see direct string comparisons in the BTF verification, for example:

    if (btf_type_is_type_tag(t)) {
    		tag_value = __btf_name_by_offset(btf, t->name_off);
    		if (strcmp(tag_value, "user") == 0)
    			info->reg_type |= MEM_USER;
    		if (strcmp(tag_value, "percpu") == 0)
    			info->reg_type |= MEM_PERCPU;
    	}

What's different is that this way a syntax is introduced, even if very
simple like "prefix:suffix". And so it potentially has to be parsed by
the tag reader, be it btf_dump or anything else. Testing a kflag is
just a much simpler operation. Maybe if we had N kinds of tags, and
not just two this would make sense?

Also. would this way of encoding be a part of the BTF spec then?
It can be done in principle, I just don't know if it's a good idea.

> 
> Also FWIW DWARF doesn't have a kind_flag.

Right, but BTF was designed with different goals, and one of them is to
be compact. kind_flag so far just hasn't been used by the tags, but it
is used in other BTF types.

> 
> [...]





[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