Re: [PATCH bpf-next v5 5/9] bpf: Implement get_current_task_btf and RET_PTR_TO_BTF_ID

From: Martin KaFai Lau
Date: Thu Nov 05 2020 - 18:22:30 EST


On Thu, Nov 05, 2020 at 10:58:23PM +0000, KP Singh wrote:
> From: KP Singh <kpsingh@xxxxxxxxxx>
>
> The currently available bpf_get_current_task returns an unsigned integer
> which can be used along with BPF_CORE_READ to read data from
> the task_struct but still cannot be used as an input argument to a
> helper that accepts an ARG_PTR_TO_BTF_ID of type task_struct.
>
> In order to implement this helper a new return type, RET_PTR_TO_BTF_ID,
> is added. This is similar to RET_PTR_TO_BTF_ID_OR_NULL but does not
> require checking the nullness of returned pointer.
>
> Acked-by: Song Liu <songliubraving@xxxxxx>
> Signed-off-by: KP Singh <kpsingh@xxxxxxxxxx>
Acked-by: Martin KaFai Lau <kafai@xxxxxx>