bpf: Allow all printable characters in BTF DATASEC names
authorEduard Zingerman <eddyz87@gmail.com>
Wed, 6 Mar 2024 10:45:28 +0000 (12:45 +0200)
committerAndrii Nakryiko <andrii@kernel.org>
Wed, 6 Mar 2024 23:18:16 +0000 (15:18 -0800)
commitbd70a8fb7ca4fcb078086f4d96b048aaf1aa4786
tree5e508f79182e882a923a5f2986a0e9fcaa53334f
parent733e5e875444fc5afc9b72714f0ecaca629ccf8a
bpf: Allow all printable characters in BTF DATASEC names

The intent is to allow libbpf to use SEC("?.struct_ops") to identify
struct_ops maps that are optional, e.g. like in the following BPF code:

    SEC("?.struct_ops")
    struct test_ops optional_map = { ... };

Which yields the following BTF:

    ...
    [13] DATASEC '?.struct_ops' size=0 vlen=...
    ...

To load such BTF libbpf rewrites DATASEC name before load.
After this patch the rewrite won't be necessary.

Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20240306104529.6453-15-eddyz87@gmail.com
kernel/bpf/btf.c