]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: enforce recursion limit on redirects
authorDaniel Borkmann <daniel@iogearbox.net>
Fri, 10 Jun 2016 19:19:06 +0000 (21:19 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sat, 11 Jun 2016 01:00:57 +0000 (18:00 -0700)
commit70def314386edb4667256127b5f18fff45c95822
treee938bd0ddcc06c32df59b527d148ffa7aab9f636
parent4d2663f8f3d164357ba02169a2e4259d4dcaf6cd
bpf: enforce recursion limit on redirects

Respect the stack's xmit_recursion limit for calls into dev_queue_xmit().
Currently, they are not handeled by the limiter when attached to clsact's
egress parent, for example, and a buggy program redirecting it to the
same device again could run into stack overflow eventually. It would be
good if we could notify an admin to give him a chance to react. We reuse
xmit_recursion instead of having one private to eBPF, so that the stack's
current recursion depth will be taken into account as well. Follow-up to
commit 5ed4fd8f9a4f ("bpf: introduce bpf_clone_redirect() helper") and
75cd92723094 ("bpf: add bpf_redirect() helper").

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