On Thu, Feb 11, 2021 at 4:59 PM Yonghong Song <yhs@xxxxxx> wrote: > > Commit 15d83c4d7cef ("bpf: Allow loading of a bpf_iter program") > cached btf_id in struct bpf_iter_target_info so later on > if it can be checked cheaply compared to checking registered names. > > syzbot found a bug that uninitialized value may occur to > bpf_iter_target_info->btf_id. This is because we allocated > bpf_iter_target_info structure with kmalloc and never initialized > field btf_id afterwards. This uninitialized btf_id is typically > compared to a u32 bpf program func proto btf_id, and the chance > of being equal is extremely slim. > > This patch fixed the issue by using kzalloc which will also > prevent future likely instances due to adding new fields. > > Reported-by: syzbot+580f4f2a272e452d55cb@xxxxxxxxxxxxxxxxxxxxxxxxx > Fixes: 15d83c4d7cef ("bpf: Allow loading of a bpf_iter program") > Signed-off-by: Yonghong Song <yhs@xxxxxx> Though it's a fix it's too late in the cycle. I've applied to bpf-next.