Re: [PATCH bpf-next] bpf: Add __bpfcall attribute to bpf_task_work_callback()
From: Mykyta Yatsenko
Date: Mon Jul 27 2026 - 09:20:43 EST
On 7/27/26 10:38 AM, Heiko Carstens wrote:
> BPF kCFI support is optional for architectures which support kCFI.
> If an architecture provides bpf kCFI support it must override the
> default __bpfcall define (which translates to __nocfi).
>
> Add the missing __bpfcall attribute to bpf_task_work_callback() which
> calls bpf programs indirectly to avoid CFI checks for such cases.
>
> Fixes: 38aa7003e369 ("bpf: task work scheduling kfuncs")
> Signed-off-by: Heiko Carstens <hca@xxxxxxxxxxxxx>
> ---
> kernel/bpf/helpers.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
> index 88b38db47de9..9bf82c9ea1da 100644
> --- a/kernel/bpf/helpers.c
> +++ b/kernel/bpf/helpers.c
> @@ -4447,7 +4447,7 @@ static void bpf_task_work_cancel(struct bpf_task_work_ctx *ctx)
> bpf_task_work_ctx_put(ctx);
> }
>
> -static void bpf_task_work_callback(struct callback_head *cb)
> +static __bpfcall void bpf_task_work_callback(struct callback_head *cb)
Thanks for the patch, I've already sent another fix:
https://lore.kernel.org/all/20260724-task_work_cfi-v1-1-2616691781ed@xxxxxxxx/
Is __bpfcall still needed?
> {
> struct bpf_task_work_ctx *ctx = container_of(cb, struct bpf_task_work_ctx, work);
> enum bpf_task_work_state state;