| 863 | } |
| 864 | |
| 865 | static const char * |
| 866 | eval_mbuf_store(const struct bpf_reg_val *rv, uint32_t opsz) |
| 867 | { |
| 868 | uint32_t i; |
| 869 | |
| 870 | static const struct { |
| 871 | size_t off; |
| 872 | size_t sz; |
| 873 | } mbuf_ro_fileds[] = { |
| 874 | { .off = offsetof(struct rte_mbuf, buf_addr), }, |
| 875 | { .off = offsetof(struct rte_mbuf, refcnt), }, |
| 876 | { .off = offsetof(struct rte_mbuf, nb_segs), }, |
| 877 | { .off = offsetof(struct rte_mbuf, buf_len), }, |
| 878 | { .off = offsetof(struct rte_mbuf, pool), }, |
| 879 | { .off = offsetof(struct rte_mbuf, next), }, |
| 880 | { .off = offsetof(struct rte_mbuf, priv_size), }, |
| 881 | }; |
| 882 | |
| 883 | for (i = 0; i != RTE_DIM(mbuf_ro_fileds) && |
| 884 | (mbuf_ro_fileds[i].off + mbuf_ro_fileds[i].sz <= |
| 885 | rv->u.max || rv->u.max + opsz <= mbuf_ro_fileds[i].off); |
| 886 | i++) |
| 887 | ; |
| 888 | |
| 889 | if (i != RTE_DIM(mbuf_ro_fileds)) |
| 890 | return "store to the read-only mbuf field"; |
| 891 | |
| 892 | return NULL; |
| 893 | |
| 894 | } |
| 895 | |
| 896 | static const char * |
| 897 | eval_store(struct bpf_verifier *bvf, const struct ebpf_insn *ins) |