]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: track stack depth of classic bpf programs
authorAlexei Starovoitov <ast@fb.com>
Tue, 30 May 2017 20:31:31 +0000 (13:31 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 31 May 2017 23:29:47 +0000 (19:29 -0400)
commit5f6270b46beb21c0a1f6fb13ad63417bd45c79f6
tree2486090dff6e58fbabb5cce544219075601e0ac0
parent47abf203f73a1e4cf7af64fb042afde1c49961bf
bpf: track stack depth of classic bpf programs

To track stack depth of classic bpf programs we only need
to analyze ST|STX instructions, since check_load_and_stores()
verifies that programs can load from stack only after write.

We also need to change the way cBPF stack slots map to eBPF stack,
since typical classic programs are using slots 0 and 1, so they
need to map to stack offsets -4 and -8 respectively in order
to take advantage of small stack interpreter and JITs.

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/filter.c