Lines Matching defs:dynptr

552 	* Please note that the spi grows downwards. For example, a dynptr
588 return stack_slot_obj_get_spi(env, reg, "dynptr", BPF_DYNPTR_NR_SLOTS);
673 struct ref_obj_desc *ref_obj, struct bpf_dynptr_desc *dynptr)
683 /* We cannot assume both spi and spi - 1 belong to the same dynptr,
689 * case they do belong to same dynptr, second call won't see slot_type
708 if (dynptr->type == BPF_DYNPTR_TYPE_INVALID) { /* dynptr constructors */
721 * object for the referenced dynptr. Freeing a referenced dynptr
731 parent_id = dynptr->parent_id;
763 * For referenced dynptr, release the parent ref which cascades to
764 * all clones and derived slices. For non-referenced dynptr, only
765 * the dynptr and slices derived from it will be invalidated.
768 return release_reference(env, dynptr_type_referenced(reg->dynptr.type)
794 if (!stack->spilled_ptr.dynptr.first_slot)
817 if (!state->stack[spi].spilled_ptr.dynptr.first_slot)
821 * A referenced dynptr can be overwritten only if there is at
822 * least one other dynptr sharing the same virtual ref parent,
825 if (dynptr_type_referenced(state->stack[spi].spilled_ptr.dynptr.type) &&
827 verbose(env, "cannot overwrite referenced dynptr\n");
829 env, env->insn_idx, "referenced dynptr overwrite",
830 "This stack slot contains a dynptr that owns or protects a referenced resource. Overwriting the last dynptr for that resource would lose the verifier-tracked release path.",
831 "Release or clone the dynptr so another live dynptr still tracks the referenced resource before overwriting this stack slot.");
835 /* Invalidate the dynptr and any derived slices */
862 * dynptr initializations because we allow overwriting existing unreferenced
864 * destroy_if_dynptr_stack_slot to ensure dynptr objects at the slots we are
890 if (!state->stack[spi].spilled_ptr.dynptr.first_slot)
908 return reg->dynptr.type;
914 return state->stack[spi].spilled_ptr.dynptr.type;
920 /* ARG_PTR_TO_DYNPTR takes any type of dynptr */
1213 * - dynptr state (STACK_DYNPTR);
1910 /* Give each dynptr a unique id to uniquely associate slices to it. */
1913 reg->dynptr.type = type;
1914 reg->dynptr.first_slot = first_slot;
3512 /* Mark slots as STACK_MISC if they belonged to spilled ptr/dynptr/iter. */
7587 * Validate dynptr arguments for helper, kfunc and subprog.
7589 * @dynptr is both input and output. It is populated when the argument is
7590 * tagged with MEM_UNINIT (i.e., the dynptr argument that will be constructed)
7591 * and consumed when the argument is expecting to be an initialized dynptr.
7593 * qdisc program) when constructing a dynptr.
7602 * Mutability of bpf_dynptr is at two levels: the dynptr and the memory the
7603 * dynptr points to. At the first level, the verifier will make sure a
7605 * a dynptr's view (i.e., start and offset) is not tracked as there is not such
7612 struct ref_obj_desc *ref_obj, struct bpf_dynptr_desc *dynptr)
7622 "Pass the address of a stack dynptr object, or use a const dynptr pointer returned by the verifier-supported path.",
7623 "a dynptr argument must be a pointer to a dynptr stack slot or a verifier-provided const struct bpf_dynptr, but %s is %s",
7638 * None - Points to a initialized dynptr that cannot be
7640 * dynptr and the memory it points to may be mutated.
7646 verbose(env, "Dynptr has to be an uninitialized dynptr\n");
7648 env, insn_idx, "dynptr is already initialized",
7649 "This kfunc constructs a dynptr and requires an uninitialized dynptr stack slot, but the selected slot already holds dynptr state.",
7650 "Use a fresh stack dynptr slot, or release/destroy the existing dynptr before reusing the slot.");
7662 err = mark_stack_slots_dynptr(env, reg, arg_type, insn_idx, ref_obj, dynptr);
7668 env, insn_idx, "const dynptr release",
7669 "This release operation was given a const dynptr. Const dynptr values are verifier-provided views and cannot be released by the program.",
7675 verbose(env, "Expected an initialized dynptr as %s\n",
7678 env, insn_idx, "uninitialized dynptr use",
7679 "This operation requires an initialized dynptr, but the stack slot does not currently hold a valid dynptr on this path.",
7680 "Initialize the dynptr on every path before this call, and avoid overwriting or releasing it before this use.");
7689 verbose(env, "Expected a dynptr of type %s as %s\n",
7693 "Use a dynptr constructor that matches this operation, or call an operation that accepts the dynptr's current type.",
7694 "the dynptr is initialized with backing object type %s, but this operation expects dynptr type %s",
7711 if (dynptr) {
7712 dynptr->type = reg->dynptr.type;
7713 dynptr->id = reg->id;
7714 dynptr->parent_id = reg->parent_id;
8329 * ARG_PTR_TO_MEM is compatible with PTR_TO_MEM that is tagged with a dynptr type.
8506 * dynptr pointing to such object, which might be at some offset
8942 arg_type, &meta->ref_obj, &meta->dynptr);
9380 * This also applies to dynptr slices belonging to skb and xdp dynptrs,
9521 * A dynptr occupies two stack slots that invalidate_dynptr()
9527 if (reg->dynptr.first_slot)
10205 * callback_fn(const struct bpf_dynptr_t* dynptr, void *callback_ctx);
10954 err = release_reg(env, reg, convert_rcu, !!meta.dynptr.id);
11063 enum bpf_dynptr_type dynptr_type = meta.dynptr.type;
11071 * invalidate all dynptr slices associated with the skb
11291 regs[BPF_REG_0].parent_id = meta.dynptr.id;
12973 enum bpf_dynptr_type parent_type = meta->dynptr.type;
12976 verifier_bug(env, "no dynptr type for parent of clone");
12984 dynptr_arg_type, &meta->ref_obj, &meta->dynptr);
13571 /* dynptr: fixed 16-byte on-stack representation */
13745 enum bpf_type_flag type_flag = get_dynptr_type_flag(meta->dynptr.type);
13769 if (!meta->dynptr.id) {
13770 verifier_bug(env, "no dynptr id");
13773 regs[BPF_REG_0].parent_id = meta->dynptr.id;
14005 err = release_reg(env, &regs[meta.release_regno], false, !!meta.dynptr.id);
19568 /* assume unspecial LOCAL dynptr type */