mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-20 19:23:57 +08:00
bpf, mips: Limit to 33 tail calls
All BPF JIT compilers except RISC-V's and MIPS' enforce a 33-tail calls
limit at runtime. In addition, a test was recently added, in tailcalls2,
to check this limit.
This patch updates the tail call limit in MIPS' JIT compiler to allow
33 tail calls.
Fixes: b6bd53f9c4
("MIPS: Add missing file for eBPF JIT.")
Reported-by: Mahshid Khezri <khezri.mahshid@gmail.com>
Signed-off-by: Paul Chaignon <paul.chaignon@orange.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/b8eb2caac1c25453c539248e56ca22f74b5316af.1575916815.git.paul.chaignon@gmail.com
This commit is contained in:
parent
96bc4432f5
commit
e49e6f6db0
@ -604,6 +604,7 @@ static void emit_const_to_reg(struct jit_ctx *ctx, int dst, u64 value)
|
||||
static int emit_bpf_tail_call(struct jit_ctx *ctx, int this_idx)
|
||||
{
|
||||
int off, b_off;
|
||||
int tcc_reg;
|
||||
|
||||
ctx->flags |= EBPF_SEEN_TC;
|
||||
/*
|
||||
@ -616,14 +617,14 @@ static int emit_bpf_tail_call(struct jit_ctx *ctx, int this_idx)
|
||||
b_off = b_imm(this_idx + 1, ctx);
|
||||
emit_instr(ctx, bne, MIPS_R_AT, MIPS_R_ZERO, b_off);
|
||||
/*
|
||||
* if (--TCC < 0)
|
||||
* if (TCC-- < 0)
|
||||
* goto out;
|
||||
*/
|
||||
/* Delay slot */
|
||||
emit_instr(ctx, daddiu, MIPS_R_T5,
|
||||
(ctx->flags & EBPF_TCC_IN_V1) ? MIPS_R_V1 : MIPS_R_S4, -1);
|
||||
tcc_reg = (ctx->flags & EBPF_TCC_IN_V1) ? MIPS_R_V1 : MIPS_R_S4;
|
||||
emit_instr(ctx, daddiu, MIPS_R_T5, tcc_reg, -1);
|
||||
b_off = b_imm(this_idx + 1, ctx);
|
||||
emit_instr(ctx, bltz, MIPS_R_T5, b_off);
|
||||
emit_instr(ctx, bltz, tcc_reg, b_off);
|
||||
/*
|
||||
* prog = array->ptrs[index];
|
||||
* if (prog == NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user