The interpreter returns R0 as unsigned int. For a function which returns long or a pointer a trampoline may pass on all 64 bits, as on s390x, and ERR_PTR(-EINVAL) becomes 0xffffffea, which IS_ERR() does not catch. Commit 3c5d146f9c69 ("bpf: Require the JIT for fmod_ret programs on tagged 64-bit targets") requires the JIT only for tagged functions. Require it for the declared ones too. Signed-off-by: Anton Protopopov --- kernel/bpf/verifier.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index e7013ed8cadd..18c7b9a6f456 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -24882,7 +24882,8 @@ static int check_attach_btf_id(struct bpf_verifier_env *env) env->fmodret_retvals = tgt_info.fmodret_retvals; /* The interpreter returns only 32 bits */ - if (env->fmodret_retvals && tgt_info.fmodel.ret_size == 8) + if (prog->expected_attach_type == BPF_MODIFY_RETURN && + tgt_info.fmodel.ret_size == 8) prog->jit_required = 1; /* -- 2.43.0