Lines Matching +full:max +full:- +full:frame +full:- +full:size

1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Copyright (c) 2011-2014 PLUMgrid, http://plumgrid.com
14 * ensures that umax_value + (int)off + (int)size cannot overflow a u64.
17 /* Maximum variable size permitted for ARG_CONST_SIZE[_OR_ZERO]. This ensures
21 /* size of type_str_buf in bpf_verifier. */
24 /* Liveness marks, used for registers and spilled-regs (in stack slots).
29 * straight-line code that reached this state (from its parent) wrote this reg"
40 REG_LIVE_READ64 = 0x2, /* likewise, but full 64-bit content matters */
61 * the map_uid is non-zero for registers
87 /* Max size from any of the above. */
108 * from a pointer-cast helper, bpf_sk_fullsock() and
121 * 8: snd_cwnd = tp->snd_cwnd; // verifier will complain
126 * the original refcounted ptr id (i.e. sk_reg->id) in ref_obj_id
128 * ref_obj_id matching the sk_reg->id.
130 * sk_reg->ref_obj_id is set to sk_reg->id at line 1.
131 * sk_reg->id will stay as NULL-marking purpose only.
132 * After NULL-marking is done, sk_reg->id can be reset to 0.
135 * fullsock_reg->ref_obj_id is set to sk_reg->ref_obj_id.
138 * tp_reg->ref_obj_id is set to fullsock_reg->ref_obj_id
139 * which is the same as sk_reg->ref_obj_id.
143 * reg->type. In particular, bpf_sk_release(tp) is also
150 * from the pointed-to object, and is shared with all bpf_reg_states
170 * R1=fp-8 and R2=fp-8, but one of them points to this function stack
172 * is used which is an index in bpf_verifier_state->frame[] array
182 /* if (!precise && SCALAR_VALUE) min/max/tnum don't affect safety */
192 * is stored in bpf_stack_state->spilled_ptr.dynptr.type
197 #define BPF_REG_SIZE 8 /* size of eBPF register in bytes */
216 * main (frame 0)
217 * cb (frame 1)
218 * func (frame 3)
219 * cb (frame 4)
220 * Hence for frame 4, if callback_ref just stored boolean, it would be
235 /* stack frame number of this function state from pov of
276 struct bpf_func_state *frame[MAX_CALL_FRAMES]; member
280 * 0 - all possible paths from this state reached bpf_exit or
282 * 1 - at least one path is being explored.
284 * 2 - at least two paths are being explored.
292 * 2 -> 1 (first 'if' pushed into stack)
294 * 2 -> 1 (second 'if' pushed into stack)
303 * 2 -> 1 (first 'if' pushed into stack)
305 * 1 -> 1 (second 'if' pushed into stack)
316 * states_maybe_looping() function. It's a stronger pre-check and
334 * For most states jmp_history_cnt is [0-3].
341 #define bpf_get_spilled_reg(slot, frame) \ argument
342 (((slot < frame->allocated_stack / BPF_REG_SIZE) && \
343 (frame->stack[slot].slot_type[0] == STACK_SPILL)) \
344 ? &frame->stack[slot].spilled_ptr : NULL)
346 /* Iterate over 'frame', setting 'reg' to either NULL or a spilled register. */
347 #define bpf_for_each_spilled_reg(iter, frame, reg) \ argument
348 for (iter = 0, reg = bpf_get_spilled_reg(iter, frame); \
349 iter < frame->allocated_stack / BPF_REG_SIZE; \
350 iter++, reg = bpf_get_spilled_reg(iter, frame))
357 for (___i = 0; ___i <= ___vstate->curframe; ___i++) { \
359 __state = ___vstate->frame[___i]; \
360 ___regs = __state->regs; \
414 u32 mem_size; /* mem_size for non-struct typed var */
423 int ctx_field_size; /* the ctx field size for load insn, maybe 0 */
424 u32 seen; /* this insn was processed by the verifier at env->pass_cnt */
434 #define MAX_USED_MAPS 64 /* max number of maps accessed by one eBPF program */
435 #define MAX_USED_BTFS 64 /* max number of BTFs accessed by one BPF program */
449 return log->len_used >= log->len_total - 1; in bpf_verifier_log_full()
464 ((log->level && log->ubuf && !bpf_verifier_log_full(log)) || in bpf_verifier_log_needed()
465 log->level == BPF_LOG_KERNEL); in bpf_verifier_log_needed()
471 return log->len_total >= 128 && log->len_total <= UINT_MAX >> 2 && in bpf_verifier_log_attr_valid()
472 log->level && log->ubuf && !(log->level & ~BPF_LOG_MASK); in bpf_verifier_log_attr_valid()
480 u32 linfo_idx; /* The idx to the main_prog->aux->linfo */
481 u16 stack_depth; /* max. stack depth used by this function */
516 struct bpf_insn_aux_data *insn_aux_data; /* array of per-insn state */
567 struct bpf_verifier_state *cur = env->cur_state; in cur_func()
569 return cur->frame[cur->curframe]; in cur_func()
574 return cur_func(env)->regs; in cur_regs()
607 return ((u64)tgt_prog->aux->id << 32) | btf_id; in bpf_trampoline_compute_key()
630 #define BPF_BASE_TYPE_MASK GENMASK(BPF_BASE_TYPE_BITS - 1, 0)
647 return prog->type == BPF_PROG_TYPE_EXT ? in resolve_prog_type()
648 prog->aux->dst_prog->type : prog->type; in resolve_prog_type()