Skip to content

Commit 5015f7c

Browse files
committed
verifier
1 parent 425bba4 commit 5015f7c

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

kernel/bpf/verifier.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2134,7 +2134,7 @@ static struct bpf_verifier_state *push_stack(struct bpf_verifier_env *env,
21342134
if (err)
21352135
goto err;
21362136
elem->st.speculative |= speculative;
2137-
if (env->stack_size > BPF_COMPLEXITY_LIMIT_JMP_SEQ) {
2137+
if (env->stack_size > BPF_COMPLEXITY_LIMIT_JMP_SEQ && !bpf_ir_builtin_pass_enabled(env->ir_env, "jmp_counter")) {
21382138
verbose(env, "The sequence of %d jumps is too complex.\n",
21392139
env->stack_size);
21402140
goto err;
@@ -2673,7 +2673,7 @@ static struct bpf_verifier_state *push_async_cb(struct bpf_verifier_env *env,
26732673
elem->log_pos = env->log.end_pos;
26742674
env->head = elem;
26752675
env->stack_size++;
2676-
if (env->stack_size > BPF_COMPLEXITY_LIMIT_JMP_SEQ) {
2676+
if (env->stack_size > BPF_COMPLEXITY_LIMIT_JMP_SEQ && !bpf_ir_builtin_pass_enabled(env->ir_env, "jmp_counter")) {
26772677
verbose(env,
26782678
"The sequence of %d jumps is too complex for async cb.\n",
26792679
env->stack_size);
@@ -6869,6 +6869,10 @@ static int check_stack_access_within_bounds(struct bpf_verifier_env *env,
68696869
enum bpf_access_src src,
68706870
enum bpf_access_type type)
68716871
{
6872+
if(bpf_ir_builtin_pass_enabled(env->ir_env, "msan")){
6873+
// Do not check bound for our trusted program
6874+
return 0;
6875+
}
68726876
struct bpf_reg_state *regs = cur_regs(env);
68736877
struct bpf_reg_state *reg = regs + regno;
68746878
struct bpf_func_state *state = func(env, reg);
@@ -17964,7 +17968,7 @@ static int do_check(struct bpf_verifier_env *env)
1796417968
++env->insn_processed;
1796517969

1796617970
if (env->insn_processed > BPF_COMPLEXITY_LIMIT_INSNS &&
17967-
!bpf_ir_builtin_pass_enabled(env->ir_env, "add_counter")) {
17971+
!bpf_ir_builtin_pass_enabled(env->ir_env, "insn_counter")) {
1796817972
verbose_err(
1796917973
363, env,
1797017974
"BPF program is too large. Processed %d insn\n",

0 commit comments

Comments
 (0)