On Thu, Nov 24, 2022 at 3:44 PM Yonghong Song <yhs@xxxxxxxx> wrote: > > > > On 11/24/22 12:34 PM, Alexei Starovoitov wrote: > > On Wed, Nov 23, 2022 at 9:32 PM Yonghong Song <yhs@xxxxxx> wrote: > >> > >> @@ -16580,6 +16682,8 @@ int bpf_check(struct bpf_prog **prog, union bpf_attr *attr, bpfptr_t uattr) > >> env->bypass_spec_v1 = bpf_bypass_spec_v1(); > >> env->bypass_spec_v4 = bpf_bypass_spec_v4(); > >> env->bpf_capable = bpf_capable(); > >> + env->rcu_tag_supported = > >> + btf_find_by_name_kind(btf_vmlinux, "rcu", BTF_KIND_TYPE_TAG) > 0; > > > > It needs btf_vmlinux != NULL check as well, > > since we error earlier only on IS_ERR(btf_vmlinux). > > btf_vmlinux can be NULL at this point when CONFIG_DEBUG_INFO_BTF is not set. > > I checked the code and it looks like btf_find_by_name_kind can handle > btf_vmlinux = NULL properly. Consider this is a unlikely case so > I did not add btf_vmlinux checking here. Good point. You're right. I got confused by the similar !btf check in bpf_find_btf_id(). There it looks to be necessary. Here it's indeed redundant. Sorry about that.