Re: [PATCH RFC bpf-next v6 2/6] bpf: Add support for KF_ARG_PTR_TO_TIMER

From: Eduard Zingerman
Date: Mon Apr 08 2024 - 17:56:10 EST


On Mon, 2024-04-08 at 10:09 +0200, bentiss@xxxxxxxxxx wrote:
> From: Kumar Kartikeya Dwivedi <memxor@xxxxxxxxx>
>
> Introduce support for KF_ARG_PTR_TO_TIMER. The kfuncs will use bpf_timer
> as argument and that will be recognized as timer argument by verifier.
> bpf_timer_kern casting can happen inside kfunc, but using bpf_timer in
> argument makes life easier for users who work with non-kern type in BPF
> progs.
>
> Fix up process_timer_func's meta argument usage (ignore if NULL) so that
> we can share the same checks for helpers and kfuncs. meta argument is
> only needed to ensure bpf_timer_init's timer and map arguments are
> coming from the same map (map_uid logic is necessary for correct
> inner-map handling).
>
> No such concerns will be necessary for kfuncs as timer initialization
> happens using helpers, hence pass NULL to process_timer_func from kfunc
> argument handling code to ignore it.
>
> Signed-off-by: Kumar Kartikeya Dwivedi <memxor@xxxxxxxxx>
> Signed-off-by: Benjamin Tissoires <bentiss@xxxxxxxxxx>
>
> ---

Acked-by: Eduard Zingerman <eddyz87@xxxxxxxxx>