• Home
  • Raw
  • Download

Lines Matching refs:i

217 	u32 i, nr_linfo;  in find_linfo()  local
226 for (i = 1; i < nr_linfo; i++) in find_linfo()
227 if (insn_off < linfo[i].insn_off) in find_linfo()
230 return &linfo[i - 1]; in find_linfo()
438 int i; in print_verifier_state() local
442 for (i = 0; i < MAX_BPF_REG; i++) { in print_verifier_state()
443 reg = &state->regs[i]; in print_verifier_state()
447 verbose(env, " R%d", i); in print_verifier_state()
501 for (i = 0; i < state->allocated_stack / BPF_REG_SIZE; i++) { in print_verifier_state()
507 if (state->stack[i].slot_type[j] != STACK_INVALID) in print_verifier_state()
510 state->stack[i].slot_type[j]]; in print_verifier_state()
515 verbose(env, " fp%d", (-i - 1) * BPF_REG_SIZE); in print_verifier_state()
516 print_liveness(env, state->stack[i].spilled_ptr.live); in print_verifier_state()
517 if (state->stack[i].slot_type[0] == STACK_SPILL) { in print_verifier_state()
518 reg = &state->stack[i].spilled_ptr; in print_verifier_state()
531 for (i = 1; i < state->acquired_refs; i++) in print_verifier_state()
532 if (state->refs[i].id) in print_verifier_state()
533 verbose(env, ",%d", state->refs[i].id); in print_verifier_state()
639 int i, last_idx; in release_reference_state() local
642 for (i = 0; i < state->acquired_refs; i++) { in release_reference_state()
643 if (state->refs[i].id == ptr_id) { in release_reference_state()
644 if (last_idx && i != last_idx) in release_reference_state()
645 memcpy(&state->refs[i], &state->refs[last_idx], in release_reference_state()
686 int i; in free_verifier_state() local
688 for (i = 0; i <= state->curframe; i++) { in free_verifier_state()
689 free_func_state(state->frame[i]); in free_verifier_state()
690 state->frame[i] = NULL; in free_verifier_state()
721 int i, err; in copy_verifier_state() local
733 for (i = src->curframe + 1; i <= dst_state->curframe; i++) { in copy_verifier_state()
734 free_func_state(dst_state->frame[i]); in copy_verifier_state()
735 dst_state->frame[i] = NULL; in copy_verifier_state()
744 for (i = 0; i <= src->curframe; i++) { in copy_verifier_state()
745 dst = dst_state->frame[i]; in copy_verifier_state()
750 dst_state->frame[i] = dst; in copy_verifier_state()
752 err = copy_func_state(dst, src->frame[i]); in copy_verifier_state()
1057 int i; in init_reg_state() local
1059 for (i = 0; i < MAX_BPF_REG; i++) { in init_reg_state()
1060 mark_reg_not_init(env, regs, i); in init_reg_state()
1061 regs[i].live = REG_LIVE_NONE; in init_reg_state()
1062 regs[i].parent = NULL; in init_reg_state()
1063 regs[i].subreg_def = DEF_NOT_SUBREG; in init_reg_state()
1135 int i, ret, subprog_start, subprog_end, off, cur_subprog = 0; in check_subprogs() local
1146 for (i = 0; i < insn_cnt; i++) { in check_subprogs()
1147 if (insn[i].code != (BPF_JMP | BPF_CALL)) in check_subprogs()
1149 if (insn[i].src_reg != BPF_PSEUDO_CALL) in check_subprogs()
1155 ret = add_subprog(env, i + insn[i].imm + 1); in check_subprogs()
1166 for (i = 0; i < env->subprog_cnt; i++) in check_subprogs()
1167 verbose(env, "func#%d @%d\n", i, subprog[i].start); in check_subprogs()
1172 for (i = 0; i < insn_cnt; i++) { in check_subprogs()
1173 u8 code = insn[i].code; in check_subprogs()
1179 off = i + insn[i].off + 1; in check_subprogs()
1181 verbose(env, "jump out of range from insn %d to %d\n", i, off); in check_subprogs()
1185 if (i == subprog_end - 1) { in check_subprogs()
1436 static int get_prev_insn_idx(struct bpf_verifier_state *st, int i, in get_prev_insn_idx() argument
1441 if (cnt && st->jmp_history[cnt - 1].idx == i) { in get_prev_insn_idx()
1442 i = st->jmp_history[cnt - 1].prev_idx; in get_prev_insn_idx()
1445 i--; in get_prev_insn_idx()
1447 return i; in get_prev_insn_idx()
1647 int i, j; in mark_all_scalars_precise() local
1653 for (i = 0; i <= st->curframe; i++) { in mark_all_scalars_precise()
1654 func = st->frame[i]; in mark_all_scalars_precise()
1684 int i, err; in __mark_chain_precision() local
1732 for (i = last_idx;;) { in __mark_chain_precision()
1737 err = backtrack_insn(env, i, &reg_mask, &stack_mask); in __mark_chain_precision()
1751 if (i == first_idx) in __mark_chain_precision()
1753 i = get_prev_insn_idx(st, i, &history); in __mark_chain_precision()
1754 if (i >= env->prog->len) { in __mark_chain_precision()
1761 verbose(env, "BUG backtracking idx %d\n", i); in __mark_chain_precision()
1773 for_each_set_bit(i, mask, 32) { in __mark_chain_precision()
1774 reg = &func->regs[i]; in __mark_chain_precision()
1776 reg_mask &= ~(1u << i); in __mark_chain_precision()
1785 for_each_set_bit(i, mask, 64) { in __mark_chain_precision()
1786 if (i >= func->allocated_stack / BPF_REG_SIZE) { in __mark_chain_precision()
1804 if (func->stack[i].slot_type[0] != STACK_SPILL) { in __mark_chain_precision()
1805 stack_mask &= ~(1ull << i); in __mark_chain_precision()
1808 reg = &func->stack[i].spilled_ptr; in __mark_chain_precision()
1810 stack_mask &= ~(1ull << i); in __mark_chain_precision()
1884 int i; in save_register_state() local
1889 for (i = 0; i < BPF_REG_SIZE; i++) in save_register_state()
1890 state->stack[spi].slot_type[i] = STACK_SPILL; in save_register_state()
1901 int i, slot = -off - 1, spi = slot / BPF_REG_SIZE, err; in check_stack_write() local
1956 for (i = 0; i < BPF_REG_SIZE; i++) in check_stack_write()
1957 if (state->stack[spi].slot_type[i] == STACK_MISC) { in check_stack_write()
1993 for (i = 0; i < BPF_REG_SIZE; i++) in check_stack_write()
1994 state->stack[spi].slot_type[i] = STACK_MISC; in check_stack_write()
2017 for (i = 0; i < size; i++) in check_stack_write()
2018 state->stack[spi].slot_type[(slot - i) % BPF_REG_SIZE] = in check_stack_write()
2030 int i, slot = -off - 1, spi = slot / BPF_REG_SIZE; in check_stack_read() local
2056 for (i = 1; i < BPF_REG_SIZE; i++) { in check_stack_read()
2057 if (stype[(slot - i) % BPF_REG_SIZE] != STACK_SPILL) { in check_stack_read()
2076 for (i = 0; i < size; i++) { in check_stack_read()
2077 if (stype[(slot - i) % BPF_REG_SIZE] == STACK_MISC) in check_stack_read()
2079 if (stype[(slot - i) % BPF_REG_SIZE] == STACK_ZERO) { in check_stack_read()
2084 off, i, size); in check_stack_read()
2610 int depth = 0, frame = 0, idx = 0, i = 0, subprog_end; in check_max_stack_depth() local
2628 for (; i < subprog_end; i++) { in check_max_stack_depth()
2629 if (insn[i].code != (BPF_JMP | BPF_CALL)) in check_max_stack_depth()
2631 if (insn[i].src_reg != BPF_PSEUDO_CALL) in check_max_stack_depth()
2634 ret_insn[frame] = i + 1; in check_max_stack_depth()
2638 i = i + insn[i].imm + 1; in check_max_stack_depth()
2639 idx = find_subprog(env, i); in check_max_stack_depth()
2642 i); in check_max_stack_depth()
2660 i = ret_insn[frame]; in check_max_stack_depth()
2980 int err, min_off, max_off, i, j, slot, spi; in check_stack_boundary() local
3053 for (i = min_off; i < max_off + access_size; i++) { in check_stack_boundary()
3056 slot = -i - 1; in check_stack_boundary()
3079 min_off, i - min_off, access_size); in check_stack_boundary()
3085 tn_buf, i - min_off, access_size); in check_stack_boundary()
3700 int i; in __clear_all_pkt_pointers() local
3702 for (i = 0; i < MAX_BPF_REG; i++) in __clear_all_pkt_pointers()
3703 if (reg_is_pkt_pointer_any(&regs[i])) in __clear_all_pkt_pointers()
3704 mark_reg_unknown(env, regs, i); in __clear_all_pkt_pointers()
3706 bpf_for_each_spilled_reg(i, state, reg) { in __clear_all_pkt_pointers()
3717 int i; in clear_all_pkt_pointers() local
3719 for (i = 0; i <= vstate->curframe; i++) in clear_all_pkt_pointers()
3720 __clear_all_pkt_pointers(env, vstate->frame[i]); in clear_all_pkt_pointers()
3728 int i; in release_reg_references() local
3730 for (i = 0; i < MAX_BPF_REG; i++) in release_reg_references()
3731 if (regs[i].ref_obj_id == ref_obj_id) in release_reg_references()
3732 mark_reg_unknown(env, regs, i); in release_reg_references()
3734 bpf_for_each_spilled_reg(i, state, reg) { in release_reg_references()
3750 int i; in release_reference() local
3756 for (i = 0; i <= vstate->curframe; i++) in release_reference()
3757 release_reg_references(env, vstate->frame[i], ref_obj_id); in release_reference()
3767 int i, err, subprog, target_insn; in check_func_call() local
3813 for (i = BPF_REG_1; i <= BPF_REG_5; i++) in check_func_call()
3814 callee->regs[i] = caller->regs[i]; in check_func_call()
3817 for (i = 0; i < CALLER_SAVED_REGS; i++) { in check_func_call()
3818 mark_reg_not_init(env, caller->regs, caller_saved[i]); in check_func_call()
3819 check_reg_arg(env, caller_saved[i], DST_OP_NO_MARK); in check_func_call()
3943 int i; in check_reference_leak() local
3945 for (i = 0; i < state->acquired_refs; i++) { in check_reference_leak()
3947 state->refs[i].id, state->refs[i].insn_idx); in check_reference_leak()
3958 int i, err; in check_helper_call() local
4024 for (i = 0; i < meta.access_size; i++) { in check_helper_call()
4025 err = check_mem_access(env, insn_idx, meta.regno, i, BPF_B, in check_helper_call()
4058 for (i = 0; i < CALLER_SAVED_REGS; i++) { in check_helper_call()
4059 mark_reg_not_init(env, regs, caller_saved[i]); in check_helper_call()
4060 check_reg_arg(env, caller_saved[i], DST_OP_NO_MARK); in check_helper_call()
5105 int i; in __find_good_pkt_pointers() local
5107 for (i = 0; i < MAX_BPF_REG; i++) { in __find_good_pkt_pointers()
5108 reg = &state->regs[i]; in __find_good_pkt_pointers()
5114 bpf_for_each_spilled_reg(i, state, reg) { in __find_good_pkt_pointers()
5128 int i; in find_good_pkt_pointers() local
5193 for (i = 0; i <= vstate->curframe; i++) in find_good_pkt_pointers()
5194 __find_good_pkt_pointers(vstate->frame[i], dst_reg, type, in find_good_pkt_pointers()
5684 int i; in __mark_ptr_or_null_regs() local
5686 for (i = 0; i < MAX_BPF_REG; i++) in __mark_ptr_or_null_regs()
5687 mark_ptr_or_null_reg(state, &state->regs[i], id, is_null); in __mark_ptr_or_null_regs()
5689 bpf_for_each_spilled_reg(i, state, reg) { in __mark_ptr_or_null_regs()
5706 int i; in mark_ptr_or_null_regs() local
5715 for (i = 0; i <= vstate->curframe; i++) in mark_ptr_or_null_regs()
5716 __mark_ptr_or_null_regs(vstate->frame[i], id, is_null); in mark_ptr_or_null_regs()
6051 int i, err; in check_ld_abs() local
6120 for (i = 0; i < CALLER_SAVED_REGS; i++) { in check_ld_abs()
6121 mark_reg_not_init(env, regs, caller_saved[i]); in check_ld_abs()
6122 check_reg_arg(env, caller_saved[i], DST_OP_NO_MARK); in check_ld_abs()
6312 int i, t; in check_cfg() local
6414 for (i = 0; i < insn_cnt; i++) { in check_cfg()
6415 if (insn_state[i] != EXPLORED) { in check_cfg()
6416 verbose(env, "unreachable insn %d\n", i); in check_cfg()
6438 u32 i, nfuncs, urec_size, min_size; in check_btf_func() local
6475 for (i = 0; i < nfuncs; i++) { in check_btf_func()
6489 if (copy_from_user(&krecord[i], urecord, min_size)) { in check_btf_func()
6495 if (i == 0) { in check_btf_func()
6496 if (krecord[i].insn_off) { in check_btf_func()
6499 krecord[i].insn_off); in check_btf_func()
6503 } else if (krecord[i].insn_off <= prev_offset) { in check_btf_func()
6506 krecord[i].insn_off, prev_offset); in check_btf_func()
6511 if (env->subprog_info[i].start != krecord[i].insn_off) { in check_btf_func()
6518 type = btf_type_by_id(btf, krecord[i].type_id); in check_btf_func()
6521 krecord[i].type_id); in check_btf_func()
6526 prev_offset = krecord[i].insn_off; in check_btf_func()
6541 int i; in adjust_btf_func() local
6546 for (i = 0; i < env->subprog_cnt; i++) in adjust_btf_func()
6547 env->prog->aux->func_info[i].insn_off = env->subprog_info[i].start; in adjust_btf_func()
6558 u32 i, s, nr_linfo, ncopy, expected_size, rec_size, prev_offset = 0; in check_btf_line() local
6592 for (i = 0; i < nr_linfo; i++) { in check_btf_line()
6604 if (copy_from_user(&linfo[i], ulinfo, ncopy)) { in check_btf_line()
6620 if ((i && linfo[i].insn_off <= prev_offset) || in check_btf_line()
6621 linfo[i].insn_off >= prog->len) { in check_btf_line()
6623 i, linfo[i].insn_off, prev_offset, in check_btf_line()
6629 if (!prog->insnsi[linfo[i].insn_off].code) { in check_btf_line()
6632 i); in check_btf_line()
6637 if (!btf_name_by_offset(btf, linfo[i].line_off) || in check_btf_line()
6638 !btf_name_by_offset(btf, linfo[i].file_name_off)) { in check_btf_line()
6639 verbose(env, "Invalid line_info[%u].line_off or .file_name_off\n", i); in check_btf_line()
6645 if (linfo[i].insn_off == sub[s].start) { in check_btf_line()
6646 sub[s].linfo_idx = i; in check_btf_line()
6648 } else if (sub[s].start < linfo[i].insn_off) { in check_btf_line()
6655 prev_offset = linfo[i].insn_off; in check_btf_line()
6731 unsigned int i; in check_ids() local
6733 for (i = 0; i < ID_MAP_SIZE; i++) { in check_ids()
6734 if (!idmap[i].old) { in check_ids()
6736 idmap[i].old = old_id; in check_ids()
6737 idmap[i].cur = cur_id; in check_ids()
6740 if (idmap[i].old == old_id) in check_ids()
6741 return idmap[i].cur == cur_id; in check_ids()
6752 int i, j; in clean_func_state() local
6754 for (i = 0; i < BPF_REG_FP; i++) { in clean_func_state()
6755 live = st->regs[i].live; in clean_func_state()
6757 st->regs[i].live |= REG_LIVE_DONE; in clean_func_state()
6762 __mark_reg_not_init(env, &st->regs[i]); in clean_func_state()
6765 for (i = 0; i < st->allocated_stack / BPF_REG_SIZE; i++) { in clean_func_state()
6766 live = st->stack[i].spilled_ptr.live; in clean_func_state()
6768 st->stack[i].spilled_ptr.live |= REG_LIVE_DONE; in clean_func_state()
6770 __mark_reg_not_init(env, &st->stack[i].spilled_ptr); in clean_func_state()
6772 st->stack[i].slot_type[j] = STACK_INVALID; in clean_func_state()
6780 int i; in clean_verifier_state() local
6786 for (i = 0; i <= st->curframe; i++) in clean_verifier_state()
6787 clean_func_state(env, st->frame[i]); in clean_verifier_state()
6826 int i; in clean_live_states() local
6835 for (i = 0; i <= cur->curframe; i++) in clean_live_states()
6836 if (sl->state.frame[i]->callsite != cur->frame[i]->callsite) in clean_live_states()
6965 int i, spi; in stacksafe() local
6971 for (i = 0; i < old->allocated_stack; i++) { in stacksafe()
6972 spi = i / BPF_REG_SIZE; in stacksafe()
6975 i += BPF_REG_SIZE - 1; in stacksafe()
6980 if (old->stack[spi].slot_type[i % BPF_REG_SIZE] == STACK_INVALID) in stacksafe()
6986 if (i >= cur->allocated_stack) in stacksafe()
6993 if (old->stack[spi].slot_type[i % BPF_REG_SIZE] == STACK_MISC && in stacksafe()
6994 cur->stack[spi].slot_type[i % BPF_REG_SIZE] == STACK_ZERO) in stacksafe()
6996 if (old->stack[spi].slot_type[i % BPF_REG_SIZE] != in stacksafe()
6997 cur->stack[spi].slot_type[i % BPF_REG_SIZE]) in stacksafe()
7004 if (i % BPF_REG_SIZE) in stacksafe()
7065 int i; in func_states_equal() local
7072 for (i = 0; i < MAX_BPF_REG; i++) { in func_states_equal()
7073 if (!regsafe(&old->regs[i], &cur->regs[i], idmap)) in func_states_equal()
7092 int i; in states_equal() local
7109 for (i = 0; i <= old->curframe; i++) { in states_equal()
7110 if (old->frame[i]->callsite != cur->frame[i]->callsite) in states_equal()
7112 if (!func_states_equal(old->frame[i], cur->frame[i])) in states_equal()
7160 int i, frame, err = 0; in propagate_liveness() local
7175 for (i = frame < vstate->curframe ? BPF_REG_6 : 0; i < BPF_REG_FP; i++) { in propagate_liveness()
7176 err = propagate_liveness_reg(env, &state_reg[i], in propagate_liveness()
7177 &parent_reg[i]); in propagate_liveness()
7181 mark_insn_zext(env, &parent_reg[i]); in propagate_liveness()
7185 for (i = 0; i < state->allocated_stack / BPF_REG_SIZE && in propagate_liveness()
7186 i < parent->allocated_stack / BPF_REG_SIZE; i++) { in propagate_liveness()
7187 parent_reg = &parent->stack[i].spilled_ptr; in propagate_liveness()
7188 state_reg = &state->stack[i].spilled_ptr; in propagate_liveness()
7206 int i, err = 0; in propagate_precision() local
7210 for (i = 0; i < BPF_REG_FP; i++, state_reg++) { in propagate_precision()
7215 verbose(env, "propagating r%d\n", i); in propagate_precision()
7216 err = mark_chain_precision(env, i); in propagate_precision()
7221 for (i = 0; i < state->allocated_stack / BPF_REG_SIZE; i++) { in propagate_precision()
7222 if (state->stack[i].slot_type[0] != STACK_SPILL) in propagate_precision()
7224 state_reg = &state->stack[i].spilled_ptr; in propagate_precision()
7230 (-i - 1) * BPF_REG_SIZE); in propagate_precision()
7231 err = mark_chain_precision_stack(env, i); in propagate_precision()
7242 int i, fr = cur->curframe; in states_maybe_looping() local
7249 for (i = 0; i < MAX_BPF_REG; i++) in states_maybe_looping()
7250 if (memcmp(&fold->regs[i], &fcur->regs[i], in states_maybe_looping()
7262 int i, j, err, states_cnt = 0; in is_state_visited() local
7443 for (i = j < cur->curframe ? BPF_REG_6 : 0; i < BPF_REG_FP; i++) in is_state_visited()
7444 cur->frame[j]->regs[i].parent = &new->frame[j]->regs[i]; in is_state_visited()
7445 for (i = 0; i < BPF_REG_FP; i++) in is_state_visited()
7446 cur->frame[j]->regs[i].live = REG_LIVE_NONE; in is_state_visited()
7454 for (i = 0; i < frame->allocated_stack / BPF_REG_SIZE; i++) { in is_state_visited()
7455 frame->stack[i].spilled_ptr.live = REG_LIVE_NONE; in is_state_visited()
7456 frame->stack[i].spilled_ptr.parent = in is_state_visited()
7457 &newframe->stack[i].spilled_ptr; in is_state_visited()
7928 int i, j, err; in replace_map_fd_with_map_ptr() local
7934 for (i = 0; i < insn_cnt; i++, insn++) { in replace_map_fd_with_map_ptr()
7954 if (i == insn_cnt - 1 || insn[1].code != 0 || in replace_map_fd_with_map_ptr()
7991 aux = &env->insn_aux_data[i]; in replace_map_fd_with_map_ptr()
8062 i++; in replace_map_fd_with_map_ptr()
8084 int i; in release_maps() local
8093 for (i = 0; i < env->used_map_cnt; i++) in release_maps()
8094 bpf_map_put(env->used_maps[i]); in release_maps()
8102 int i; in convert_pseudo_ld_imm64() local
8104 for (i = 0; i < insn_cnt; i++, insn++) in convert_pseudo_ld_imm64()
8119 int i; in adjust_insn_aux_data() local
8137 for (i = off; i < off + cnt - 1; i++) { in adjust_insn_aux_data()
8138 new_data[i].seen = true; in adjust_insn_aux_data()
8139 new_data[i].zext_dst = insn_has_def32(env, insn + i); in adjust_insn_aux_data()
8148 int i; in adjust_subprog_starts() local
8153 for (i = 0; i <= env->subprog_cnt; i++) { in adjust_subprog_starts()
8154 if (env->subprog_info[i].start <= off) in adjust_subprog_starts()
8156 env->subprog_info[i].start += len - 1; in adjust_subprog_starts()
8182 int i, j; in adjust_subprog_starts_after_remove() local
8185 for (i = 0; i < env->subprog_cnt; i++) in adjust_subprog_starts_after_remove()
8186 if (env->subprog_info[i].start >= off) in adjust_subprog_starts_after_remove()
8189 for (j = i; j < env->subprog_cnt; j++) in adjust_subprog_starts_after_remove()
8198 if (j > i) { in adjust_subprog_starts_after_remove()
8205 memmove(env->subprog_info + i, in adjust_subprog_starts_after_remove()
8208 env->subprog_cnt -= j - i; in adjust_subprog_starts_after_remove()
8214 memmove(aux->func_info + i, in adjust_subprog_starts_after_remove()
8217 aux->func_info_cnt -= j - i; in adjust_subprog_starts_after_remove()
8224 if (env->subprog_info[i].start == off) in adjust_subprog_starts_after_remove()
8225 i++; in adjust_subprog_starts_after_remove()
8229 for (; i <= env->subprog_cnt; i++) in adjust_subprog_starts_after_remove()
8230 env->subprog_info[i].start -= cnt; in adjust_subprog_starts_after_remove()
8239 u32 i, l_off, l_cnt, nr_linfo; in bpf_adj_linfo_after_remove() local
8249 for (i = 0; i < nr_linfo; i++) in bpf_adj_linfo_after_remove()
8250 if (linfo[i].insn_off >= off) in bpf_adj_linfo_after_remove()
8253 l_off = i; in bpf_adj_linfo_after_remove()
8255 for (; i < nr_linfo; i++) in bpf_adj_linfo_after_remove()
8256 if (linfo[i].insn_off < off + cnt) in bpf_adj_linfo_after_remove()
8266 (i == nr_linfo || linfo[i].insn_off != off + cnt)) { in bpf_adj_linfo_after_remove()
8268 linfo[--i].insn_off = off + cnt; in bpf_adj_linfo_after_remove()
8273 memmove(linfo + l_off, linfo + i, in bpf_adj_linfo_after_remove()
8274 sizeof(*linfo) * (nr_linfo - i)); in bpf_adj_linfo_after_remove()
8281 for (i = l_off; i < nr_linfo; i++) in bpf_adj_linfo_after_remove()
8282 linfo[i].insn_off -= cnt; in bpf_adj_linfo_after_remove()
8285 for (i = 0; i <= env->subprog_cnt; i++) in bpf_adj_linfo_after_remove()
8286 if (env->subprog_info[i].linfo_idx > l_off) { in bpf_adj_linfo_after_remove()
8290 if (env->subprog_info[i].linfo_idx >= l_off + l_cnt) in bpf_adj_linfo_after_remove()
8291 env->subprog_info[i].linfo_idx -= l_cnt; in bpf_adj_linfo_after_remove()
8293 env->subprog_info[i].linfo_idx = l_off; in bpf_adj_linfo_after_remove()
8343 int i; in sanitize_dead_code() local
8345 for (i = 0; i < insn_cnt; i++) { in sanitize_dead_code()
8346 if (aux_data[i].seen) in sanitize_dead_code()
8348 memcpy(insn + i, &trap, sizeof(trap)); in sanitize_dead_code()
8372 int i; in opt_hard_wire_dead_code_branches() local
8374 for (i = 0; i < insn_cnt; i++, insn++) { in opt_hard_wire_dead_code_branches()
8378 if (!aux_data[i + 1].seen) in opt_hard_wire_dead_code_branches()
8380 else if (!aux_data[i + 1 + insn->off].seen) in opt_hard_wire_dead_code_branches()
8386 bpf_prog_offload_replace_insn(env, i, &ja); in opt_hard_wire_dead_code_branches()
8396 int i, err; in opt_remove_dead_code() local
8398 for (i = 0; i < insn_cnt; i++) { in opt_remove_dead_code()
8402 while (i + j < insn_cnt && !aux_data[i + j].seen) in opt_remove_dead_code()
8407 err = verifier_remove_insns(env, i, j); in opt_remove_dead_code()
8421 int i, err; in opt_remove_nops() local
8423 for (i = 0; i < insn_cnt; i++) { in opt_remove_nops()
8424 if (memcmp(&insn[i], &ja, sizeof(ja))) in opt_remove_nops()
8427 err = verifier_remove_insns(env, i, 1); in opt_remove_nops()
8431 i--; in opt_remove_nops()
8442 int i, patch_len, delta = 0, len = env->prog->len; in opt_subreg_zext_lo32_rnd_hi32() local
8452 for (i = 0; i < len; i++) { in opt_subreg_zext_lo32_rnd_hi32()
8453 int adj_idx = i + delta; in opt_subreg_zext_lo32_rnd_hi32()
8476 i++; in opt_subreg_zext_lo32_rnd_hi32()
8523 int i, cnt, size, ctx_field_size, delta = 0; in convert_ctx_accesses() local
8556 for (i = 0; i < insn_cnt; i++, insn++) { in convert_ctx_accesses()
8573 env->insn_aux_data[i + delta].sanitize_stack_off) { in convert_ctx_accesses()
8581 env->insn_aux_data[i + delta].sanitize_stack_off, in convert_ctx_accesses()
8590 new_prog = bpf_patch_insn_data(env, i + delta, patch, cnt); in convert_ctx_accesses()
8596 insn = new_prog->insnsi + i + delta; in convert_ctx_accesses()
8600 switch (env->insn_aux_data[i + delta].ptr_type) { in convert_ctx_accesses()
8620 ctx_field_size = env->insn_aux_data[i + delta].ctx_field_size; in convert_ctx_accesses()
8678 new_prog = bpf_patch_insn_data(env, i + delta, insn_buf, cnt); in convert_ctx_accesses()
8686 insn = new_prog->insnsi + i + delta; in convert_ctx_accesses()
8695 int i, j, subprog_start, subprog_end = 0, len, subprog; in jit_subprogs() local
8703 for (i = 0, insn = prog->insnsi; i < prog->len; i++, insn++) { in jit_subprogs()
8711 subprog = find_subprog(env, i + insn->imm + 1); in jit_subprogs()
8714 i + insn->imm + 1); in jit_subprogs()
8724 env->insn_aux_data[i].call_imm = insn->imm; in jit_subprogs()
8738 for (i = 0; i < env->subprog_cnt; i++) { in jit_subprogs()
8740 subprog_end = env->subprog_info[i + 1].start; in jit_subprogs()
8748 func[i] = bpf_prog_alloc_no_stats(bpf_prog_size(len), GFP_USER); in jit_subprogs()
8749 if (!func[i]) in jit_subprogs()
8751 memcpy(func[i]->insnsi, &prog->insnsi[subprog_start], in jit_subprogs()
8753 func[i]->type = prog->type; in jit_subprogs()
8754 func[i]->len = len; in jit_subprogs()
8755 if (bpf_prog_calc_tag(func[i])) in jit_subprogs()
8757 func[i]->is_func = 1; in jit_subprogs()
8758 func[i]->aux->func_idx = i; in jit_subprogs()
8760 func[i]->aux->btf = prog->aux->btf; in jit_subprogs()
8761 func[i]->aux->func_info = prog->aux->func_info; in jit_subprogs()
8766 func[i]->aux->name[0] = 'F'; in jit_subprogs()
8767 func[i]->aux->stack_depth = env->subprog_info[i].stack_depth; in jit_subprogs()
8768 func[i]->jit_requested = 1; in jit_subprogs()
8769 func[i]->aux->linfo = prog->aux->linfo; in jit_subprogs()
8770 func[i]->aux->nr_linfo = prog->aux->nr_linfo; in jit_subprogs()
8771 func[i]->aux->jited_linfo = prog->aux->jited_linfo; in jit_subprogs()
8772 func[i]->aux->linfo_idx = env->subprog_info[i].linfo_idx; in jit_subprogs()
8773 func[i] = bpf_int_jit_compile(func[i]); in jit_subprogs()
8774 if (!func[i]->jited) { in jit_subprogs()
8784 for (i = 0; i < env->subprog_cnt; i++) { in jit_subprogs()
8785 insn = func[i]->insnsi; in jit_subprogs()
8786 for (j = 0; j < func[i]->len; j++, insn++) { in jit_subprogs()
8806 func[i]->aux->func = func; in jit_subprogs()
8807 func[i]->aux->func_cnt = env->subprog_cnt; in jit_subprogs()
8809 for (i = 0; i < env->subprog_cnt; i++) { in jit_subprogs()
8810 old_bpf_func = func[i]->bpf_func; in jit_subprogs()
8811 tmp = bpf_int_jit_compile(func[i]); in jit_subprogs()
8812 if (tmp != func[i] || func[i]->bpf_func != old_bpf_func) { in jit_subprogs()
8823 for (i = 0; i < env->subprog_cnt; i++) { in jit_subprogs()
8824 bpf_prog_lock_ro(func[i]); in jit_subprogs()
8825 bpf_prog_kallsyms_add(func[i]); in jit_subprogs()
8832 for (i = 0, insn = prog->insnsi; i < prog->len; i++, insn++) { in jit_subprogs()
8836 insn->off = env->insn_aux_data[i].call_imm; in jit_subprogs()
8837 subprog = find_subprog(env, i + insn->off + 1); in jit_subprogs()
8848 for (i = 0; i < env->subprog_cnt; i++) in jit_subprogs()
8849 if (func[i]) in jit_subprogs()
8850 bpf_jit_free(func[i]); in jit_subprogs()
8855 for (i = 0, insn = prog->insnsi; i < prog->len; i++, insn++) { in jit_subprogs()
8860 insn->imm = env->insn_aux_data[i].call_imm; in jit_subprogs()
8871 int i, depth; in fixup_call_args() local
8884 for (i = 0; i < prog->len; i++, insn++) { in fixup_call_args()
8888 depth = get_callee_stack_depth(env, insn, i); in fixup_call_args()
8914 int i, cnt, delta = 0; in fixup_bpf_calls() local
8916 for (i = 0; i < insn_cnt; i++, insn++) { in fixup_bpf_calls()
8947 new_prog = bpf_patch_insn_data(env, i + delta, patchlet, cnt); in fixup_bpf_calls()
8953 insn = new_prog->insnsi + i + delta; in fixup_bpf_calls()
8966 new_prog = bpf_patch_insn_data(env, i + delta, insn_buf, cnt); in fixup_bpf_calls()
8972 insn = new_prog->insnsi + i + delta; in fixup_bpf_calls()
8985 aux = &env->insn_aux_data[i + delta]; in fixup_bpf_calls()
9018 new_prog = bpf_patch_insn_data(env, i + delta, insn_buf, cnt); in fixup_bpf_calls()
9024 insn = new_prog->insnsi + i + delta; in fixup_bpf_calls()
9057 aux = &env->insn_aux_data[i + delta]; in fixup_bpf_calls()
9081 new_prog = bpf_patch_insn_data(env, i + delta, insn_buf, cnt); in fixup_bpf_calls()
9087 insn = new_prog->insnsi + i + delta; in fixup_bpf_calls()
9102 aux = &env->insn_aux_data[i + delta]; in fixup_bpf_calls()
9116 new_prog = bpf_patch_insn_data(env, i + delta, in fixup_bpf_calls()
9123 insn = new_prog->insnsi + i + delta; in fixup_bpf_calls()
9192 int i; in free_states() local
9205 for (i = 0; i < state_htab_size(env); i++) { in free_states()
9206 sl = env->explored_states[i]; in free_states()
9221 int i; in print_verification_stats() local
9227 for (i = 0; i < env->subprog_cnt; i++) { in print_verification_stats()
9228 u32 depth = env->subprog_info[i].stack_depth; in print_verification_stats()
9231 if (i + 1 < env->subprog_cnt) in print_verification_stats()
9249 int i, len, ret = -EINVAL; in bpf_check() local
9270 for (i = 0; i < len; i++) in bpf_check()
9271 env->insn_aux_data[i].orig_idx = i; in bpf_check()