Skip to content

Commit 985a412

Browse files
committed
bpf: cel: require __V511_BPF_PROG or later
Loading the programs in 5.4 and 4.19 fails with: ; tail_call(ctx, tailcalls, TAIL_CALL_ARGS); 3573: (bf) r1 = r6 3574: (18) r2 = 0xffff888138f0e400 3576: (b7) r3 = 3 3577: (85) call bpf_tail_call#12 tail_calls are not allowed in programs with bpf-to-bpf calls Because tail-calls cannot mix with bpf-to-bpf calls. Add an appropriate guard for this. Signed-off-by: Kornilios Kourtis <[email protected]>
1 parent 19d4ef6 commit 985a412

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

bpf/process/cel_expr.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@
88
* The code for the cel_expr_N functions will be generated and linked whtn the policy is loaded
99
*/
1010

11-
#if defined(GENERIC_KPROBE) && !defined(__MULTI_KPROBE)
11+
/*
12+
* NB: The cel_expr code uses bpf-to-bpf calls, so it needs to be guarded by __V511_BPF_PROG because
13+
* previous kernel vesions do not allow mixing bpf-to-bpf calls and tail-calls. Ref:
14+
* https://lore.kernel.org/bpf/[email protected]/T/
15+
*/
16+
#if defined(__V511_BPF_PROG) && (defined(GENERIC_KPROBE) && !defined(__MULTI_KPROBE))
1217
int cel_expr_0(long *argsoff, char *args);
1318
int cel_expr_1(long *argsoff, char *args);
1419
int cel_expr_2(long *argsoff, char *args);

0 commit comments

Comments
 (0)