On Tue, 22 Aug 2023 at 10:31, Yonghong Song <yonghong.song@xxxxxxxxx> wrote: > > When reviewing local percpu kptr support, Alexei discovered a bug > wherea bpf_kptr_xchg() may succeed even if the map value kptr type and > locally allocated obj type do not match ([1]). Missed struct btf_id > comparison is the reason for the bug. This patch added such struct btf_id > comparison and will flag verification failure if types do not match. > > [1] https://lore.kernel.org/bpf/20230819002907.io3iphmnuk43xblu@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/#t > > Reported-by: Alexei Starovoitov <ast@xxxxxxxxxx> > Fixes: 738c96d5e2e3 ("bpf: Allow local kptrs to be exchanged via bpf_kptr_xchg") > Signed-off-by: Yonghong Song <yonghong.song@xxxxxxxxx> > --- Acked-by: Kumar Kartikeya Dwivedi <memxor@xxxxxxxxx>