On Thu, Apr 6, 2023 at 1:55 PM Andrii Nakryiko andrii.nakryiko@gmail.com wrote:
Something feels off here. Can you paste a bit of verifier log for the failure you were getting. And let's have a selftest for this situation as well.
ARG_PTR_TO_MEM shouldn't be qualified with the DYNPTR_TYPE flag, it's just memory, there is no need to know what type of dynptr it was derived from. So if that happens, the problem is somewhere else. Let's root cause and fix that. Having a selftest that demonstrates the problem will help with that.
This label is added by dynptr_slice(_rdwr)
if (meta.func_id == special_kfunc_list[KF_bpf_dynptr_slice] || meta.func_id == special_kfunc_list[KF_bpf_dynptr_slice_rdwr]) { enum bpf_type_flag type_flag = get_dynptr_type_flag(meta.initialized_dynptr.type); ... regs[BPF_REG_0].type = PTR_TO_MEM | type_flag;
That extra flag was causing the type to be unexpected later on. I'll add a selftest for this as well.