Skip to content
  • Yonghong Song's avatar
    bpf: btf: check name validity for various types · eb04bbb6
    Yonghong Song authored
    This patch added name checking for the following types:
     . BTF_KIND_PTR, BTF_KIND_ARRAY, BTF_KIND_VOLATILE,
       BTF_KIND_CONST, BTF_KIND_RESTRICT:
         the name must be null
     . BTF_KIND_STRUCT, BTF_KIND_UNION: the struct/member name
         is either null or a valid identifier
     . BTF_KIND_ENUM: the enum type name is either null or a valid
         identifier; the enumerator name must be a valid identifier.
     . BTF_KIND_FWD: the name must be a valid identifier
     . BTF_KIND_TYPEDEF: the name must be a valid identifier
    
    For those places a valid name is required, the name must be
    a valid C identifier. This can be relaxed later if we found
    use cases for a different (non-C) frontend.
    
    Fixes: 69b693f0
    
     ("bpf: btf: Introduce BPF Type Format (BTF)")
    Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
    Signed-off-by: default avatarYonghong Song <yhs@fb.com>
    Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
    eb04bbb6