| 942 | } |
| 943 | |
| 944 | static const char * |
| 945 | eval_func_arg(struct bpf_verifier *bvf, const struct rte_bpf_arg *arg, |
| 946 | struct bpf_reg_val *rv) |
| 947 | { |
| 948 | uint32_t i, n; |
| 949 | struct bpf_eval_state *st; |
| 950 | const char *err; |
| 951 | |
| 952 | st = bvf->evst; |
| 953 | |
| 954 | if (rv->v.type == RTE_BPF_ARG_UNDEF) |
| 955 | return "Undefined argument type"; |
| 956 | |
| 957 | if (arg->type != rv->v.type && |
| 958 | arg->type != RTE_BPF_ARG_RAW && |
| 959 | (arg->type != RTE_BPF_ARG_PTR || |
| 960 | RTE_BPF_ARG_PTR_TYPE(rv->v.type) == 0)) |
| 961 | return "Invalid argument type"; |
| 962 | |
| 963 | err = NULL; |
| 964 | |
| 965 | /* argument is a pointer */ |
| 966 | if (RTE_BPF_ARG_PTR_TYPE(arg->type) != 0) { |
| 967 | |
| 968 | err = eval_ptr(bvf, rv, arg->size, 1, 0); |
| 969 | |
| 970 | /* |
| 971 | * pointer to the variable on the stack is passed |
| 972 | * as an argument, mark stack space it occupies as initialized. |
| 973 | */ |
| 974 | if (err == NULL && rv->v.type == BPF_ARG_PTR_STACK) { |
| 975 | |
| 976 | i = rv->u.max / sizeof(uint64_t); |
| 977 | n = i + arg->size / sizeof(uint64_t); |
| 978 | while (i != n) { |
| 979 | eval_fill_max_bound(st->sv + i, UINT64_MAX); |
| 980 | i++; |
| 981 | }; |
| 982 | } |
| 983 | } |
| 984 | |
| 985 | return err; |
| 986 | } |
| 987 | |
| 988 | static const char * |
| 989 | eval_call(struct bpf_verifier *bvf, const struct ebpf_insn *ins) |
no test coverage detected