MCPcopy Create free account
hub / github.com/F-Stack/f-stack / eval_store

Function eval_store

dpdk/lib/bpf/bpf_validate.c:896–942  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

894}
895
896static const char *
897eval_store(struct bpf_verifier *bvf, const struct ebpf_insn *ins)
898{
899 uint32_t opsz;
900 uint64_t msk;
901 const char *err;
902 struct bpf_eval_state *st;
903 struct bpf_reg_val rd, rs, *sv;
904
905 opsz = bpf_size(BPF_SIZE(ins->code));
906 msk = RTE_LEN2MASK(opsz * CHAR_BIT, uint64_t);
907
908 st = bvf->evst;
909 rd = st->rv[ins->dst_reg];
910
911 if (BPF_CLASS(ins->code) == BPF_STX) {
912 rs = st->rv[ins->src_reg];
913 eval_apply_mask(&rs, msk);
914 } else
915 eval_fill_imm(&rs, msk, ins->imm);
916
917 err = eval_defined(NULL, &rs);
918 if (err != NULL)
919 return err;
920
921 err = eval_ptr(bvf, &rd, opsz, 1, ins->off);
922 if (err != NULL)
923 return err;
924
925 if (rd.v.type == BPF_ARG_PTR_STACK) {
926
927 sv = st->sv + rd.u.max / sizeof(uint64_t);
928 if (BPF_CLASS(ins->code) == BPF_STX &&
929 BPF_MODE(ins->code) == EBPF_XADD)
930 eval_max_bound(sv, msk);
931 else
932 *sv = rs;
933
934 /* pointer to mbuf */
935 } else if (rd.v.type == RTE_BPF_ARG_PTR_MBUF) {
936 err = eval_mbuf_store(&rd, opsz);
937 if (err != NULL)
938 return err;
939 }
940
941 return NULL;
942}
943
944static const char *
945eval_func_arg(struct bpf_verifier *bvf, const struct rte_bpf_arg *arg,

Callers

nothing calls this directly

Calls 7

bpf_sizeFunction · 0.85
eval_apply_maskFunction · 0.85
eval_fill_immFunction · 0.85
eval_definedFunction · 0.85
eval_ptrFunction · 0.85
eval_max_boundFunction · 0.85
eval_mbuf_storeFunction · 0.85

Tested by

no test coverage detected