Re: [PATCH bpf-next] bpf, lsm: Make bpf_lsm_get_retval_range() return void

From: Anton Protopopov

Date: Mon Nov 23 2026 - 07:57:11 EST


On 26/11/20 04:28AM, Jose Fernandez (Anthropic) wrote:
> With CONFIG_BPF_FMODRET_SCAN=y, fmod_ret programs can attach to tagged
> functions, so a program on bpf_lsm_get_retval_range() can make it fail
> for an LSM hook that returns a value. get_func_retval_range() then
> reports no range, and do_refine_retval_range() and check_helper_call()
> ignore the error and use a range the call did not set.
>
> The function fails only for a void hook, which every caller but
> get_func_retval_range() already rules out. Check for a void hook there
> and make the function return void, so resolve_btfids no longer tags
> it and no fmod_ret program can attach to it.
>
> Fixes: bc45414d1690 ("bpf: Allow fmod_ret on tagged functions and check the return value")
> Signed-off-by: Jose Fernandez (Anthropic) <jose.fernandez@xxxxxxxxx>

The change looks ok, makes sense for this function.

I am not sure if the topic should be 'bpf, lsm',
I see no lsm part here. Otherwise,

Acked-by: Anton Protopopov <a.s.protopopov@xxxxxxxxx>

> ...