On Sat, Mar 23, 2024 at 9:57 PM Kumar Kartikeya Dwivedi memxor@gmail.com wrote:
Observation is correct. The patch is buggy, but the suggestion to follow process_dynptr_func() will lead to unnecessary complexity. dynptr-s are on stack with plenty of extra checks.
The suggestion was to call process_timer_func, not process_dynptr_func.
In this case bpf_timer is in map_value. Much simpler is to follow KF_ARG_PTR_TO_MAP approach.
What I meant by the example was that dynptr handling does the same thing for kfuncs and helpers (using the same function), so timer arguments should do the same (i.e. use process_timer_func), which will do all checks for constant offset (ensuring var_off is tnum_is_const) and match it against btf_record->timer_off.
I don't follow. Please elaborate with a patch. The var_off and off is a part of the bug, but it's not the biggest part of it.
Not compile tested.
I see. All makes sense to me.
Benjamin, pls incorporate it in your set.