summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/parallel-perf.py
diff options
context:
space:
mode:
authorAlexei Starovoitov <ast@kernel.org>2026-11-01 19:05:17 +0000
committerAlexei Starovoitov <ast@kernel.org>2026-11-02 00:10:39 +0000
commit07684726d39e56c1c800d3b3e51915fb0975a46d (patch)
tree14ad37f96756c14e4db6f3bf0ed2304052c0c8cd /tools/perf/scripts/python/parallel-perf.py
parentf89ebf07496b041cb21beda60ec3452fecf34d10 (diff)
bpf: Don't turn struct arguments of KF_ACQUIRE kfuncs into memory
When a kfunc takes a pointer to a struct that has only scalar members, the verifier also accepts memory of the prog. Then resolve_func_arg_type() changes ARG_PTR_TO_BTF_ID to ARG_PTR_TO_MEM. This is correct for a struct of parameters. But struct bpf_cpumask also has only scalar members, and the kernel allocates and frees it. Thus bpf_cpumask_acquire() returns memory of the prog as a referenced object, and bpf_cpumask_release() can free it. The verifier does not change the argument that a kfunc releases. KF_ACQUIRE does not say which argument is the object. Thus do not change any argument of a KF_ACQUIRE kfunc. Then the verifier rejects memory there. No other KF_ACQUIRE kfunc takes memory in an ARG_PTR_TO_BTF_ID argument. Add to kfuncs.rst that a KF_ACQUIRE kfunc must pair a struct of parameters with a __sz argument. The first commit below added the bug. Later the struct had pointers in an rcu_head, so the verifier rejected memory. The second commit removed them. Fixes: 516f4d3397c9 ("bpf: Enable cpumasks to be queried and used as kptrs") Fixes: 8e07bb9ebcd9 ("bpf: Convert bpf_cpumask to bpf_mem_cache_free_rcu.") Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://patch.msgid.link/20261101190535.1454146-10-alexei.starovoitov@gmail.com
Diffstat (limited to 'tools/perf/scripts/python/parallel-perf.py')
0 files changed, 0 insertions, 0 deletions