git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
examples/l3fwd: share queue size variables
[dpdk.git]
/
lib
/
bpf
/
bpf_validate.c
diff --git
a/lib/bpf/bpf_validate.c
b/lib/bpf/bpf_validate.c
index
7b1291b
..
9ff86fc
100644
(file)
--- a/
lib/bpf/bpf_validate.c
+++ b/
lib/bpf/bpf_validate.c
@@
-2,7
+2,6
@@
* Copyright(c) 2018 Intel Corporation
*/
* Copyright(c) 2018 Intel Corporation
*/
-#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
@@
-10,8
+9,6
@@
#include <inttypes.h>
#include <rte_common.h>
#include <inttypes.h>
#include <rte_common.h>
-#include <rte_eal.h>
-#include <rte_byteorder.h>
#include "bpf_impl.h"
#include "bpf_impl.h"
@@
-661,8
+658,15
@@
eval_alu(struct bpf_verifier *bvf, const struct ebpf_insn *ins)
op = BPF_OP(ins->code);
op = BPF_OP(ins->code);
+ /* Allow self-xor as way to zero register */
+ if (op == BPF_XOR && BPF_SRC(ins->code) == BPF_X &&
+ ins->src_reg == ins->dst_reg) {
+ eval_fill_imm(&rs, UINT64_MAX, 0);
+ eval_fill_imm(rd, UINT64_MAX, 0);
+ }
+
err = eval_defined((op != EBPF_MOV) ? rd : NULL,
err = eval_defined((op != EBPF_MOV) ? rd : NULL,
- (op != BPF_NEG) ? &rs : NULL);
+
(op != BPF_NEG) ? &rs : NULL);
if (err != NULL)
return err;
if (err != NULL)
return err;
@@
-1723,7
+1727,7
@@
static const struct bpf_ins_check ins_chk[UINT8_MAX + 1] = {
/*
* make sure that instruction syntax is valid,
/*
* make sure that instruction syntax is valid,
- * and it
fields don't violate partciular instrcu
tion type restrictions.
+ * and it
s fields don't violate particular instruc
tion type restrictions.
*/
static const char *
check_syntax(const struct ebpf_insn *ins)
*/
static const char *
check_syntax(const struct ebpf_insn *ins)
@@
-1954,7
+1958,7
@@
log_loop(const struct bpf_verifier *bvf)
* First pass goes though all instructions in the set, checks that each
* instruction is a valid one (correct syntax, valid field values, etc.)
* and constructs control flow graph (CFG).
* First pass goes though all instructions in the set, checks that each
* instruction is a valid one (correct syntax, valid field values, etc.)
* and constructs control flow graph (CFG).
- * Then de
a
pth-first search is performed over the constructed graph.
+ * Then depth-first search is performed over the constructed graph.
* Programs with unreachable instructions and/or loops will be rejected.
*/
static int
* Programs with unreachable instructions and/or loops will be rejected.
*/
static int
@@
-1981,7
+1985,7
@@
validate(struct bpf_verifier *bvf)
/*
* construct CFG, jcc nodes have to outgoing edges,
/*
* construct CFG, jcc nodes have to outgoing edges,
- * 'exit' nodes - none, all other
s nodes have exaclt
y one
+ * 'exit' nodes - none, all other
nodes have exactl
y one
* outgoing edge.
*/
switch (ins->code) {
* outgoing edge.
*/
switch (ins->code) {
@@
-2251,7
+2255,7
@@
evaluate(struct bpf_verifier *bvf)
idx = get_node_idx(bvf, node);
op = ins[idx].code;
idx = get_node_idx(bvf, node);
op = ins[idx].code;
- /* for jcc node make a copy of evaluat
o
ion state */
+ /* for jcc node make a copy of evaluation state */
if (node->nb_edge > 1)
rc |= save_eval_state(bvf, node);
if (node->nb_edge > 1)
rc |= save_eval_state(bvf, node);