diff options
author | Yonghong Song <yonghong.song@linux.dev> | 2023-08-21 22:00:53 -0700 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2023-08-22 09:43:55 -0700 |
commit | ab6c637ad0276e42f8acabcbc64932a6d346dab3 (patch) | |
tree | 949811202c1bf84feed08e2606739abfabd6db19 /scripts/generate_rust_analyzer.py | |
parent | d56518380085d78f179cdc701d791ace4acb1d23 (diff) |
bpf: Fix a bpf_kptr_xchg() issue with local kptr
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@macbook-pro-8.dhcp.thefacebook.com/#t
Reported-by: Alexei Starovoitov <ast@kernel.org>
Fixes: 738c96d5e2e3 ("bpf: Allow local kptrs to be exchanged via bpf_kptr_xchg")
Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/r/20230822050053.2886960-1-yonghong.song@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'scripts/generate_rust_analyzer.py')
0 files changed, 0 insertions, 0 deletions