[PATCH v2 bpf-next 14/18] bpf: Require the JIT for fmod_ret programs on found 64-bit targets
From: Anton Protopopov
Date: Mon Nov 09 2026 - 12:15:38 EST
The interpreter returns only the low 32 bits of the return value of a
program, while the trampoline passes all 64 bits to the caller of the
function. If an fmod_ret program on a found target which returns long
is interpreted, then a valid return value like -14 reaches the caller
as 4294967282. This value is not 0, so the function is skipped, and it
is not an error either.
Require the JIT for such programs, as for other features which the
interpreter does not support. The caller of a function which returns int
reads only the low 32 bits, so nothing changes for it.
Signed-off-by: Anton Protopopov <a.s.protopopov@xxxxxxxxx>
---
kernel/bpf/verifier.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index f3476b12c58a..5045d9fa68b9 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -23875,6 +23875,9 @@ static int fmodret_retval_init(struct bpf_verifier_env *env, u32 btf_id,
aux->fmodret_retvals = retvals;
aux->fmodret_retval_cnt = cnt;
+ /* The interpreter returns only 32 bits */
+ if (size == 8)
+ env->prog->jit_required = 1;
return 0;
invalid:
--
2.43.0