Hello,
在 2023/11/7 02:26, Yonghong Song 写道:
On 11/5/23 5:34 AM, Chuyi Zhou wrote:
BTF_TYPE_SAFE_TRUSTED(struct bpf_iter__task) in verifier.c wanted to
teach BPF verifier that bpf_iter__task -> task is a trusted ptr. But it
doesn't work well.
The reason is, bpf_iter__task -> task would go through btf_ctx_access()
which enforces the reg_type of 'task' is ctx_arg_info->reg_type, and in
task_iter.c, we actually explicitly declare that the
ctx_arg_info->reg_type is PTR_TO_BTF_ID_OR_NULL.
This patch sets ctx_arg_info->reg_type is PTR_TO_BTF_ID_OR_NULL |
PTR_TRUSTED in task_reg_info.
Actually we have a previous case like this. See
https://lore.kernel.org/all/20230706133932.45883-3-aspsk@xxxxxxxxxxxxx/
where PTR_TRUSTED is added to the arg flag for map_iter.
You could mention this case in your commit message.
Thanks, will do it in next version.