]> git.baikalelectronics.ru Git - kernel.git/commit
bpf, test: fix ld_abs + vlan push/pop stress test
authorDaniel Borkmann <daniel@iogearbox.net>
Thu, 20 Oct 2016 15:13:53 +0000 (17:13 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 20 Oct 2016 18:39:06 +0000 (14:39 -0400)
commitb1ac72c6e59cf2aabfd077b64873d98a227091ee
treebf8e18e99469f584989b847b7f8e0101ed7913f5
parentecbb07e1d5ce27d444f6c3c4b67f3e504da8ed8a
bpf, test: fix ld_abs + vlan push/pop stress test

After commit 06053689bed2 ("net: skbuff: Remove errornous length
validation in skb_vlan_pop()") mentioned test case stopped working,
throwing a -12 (ENOMEM) return code. The issue however is not due to
06053689bed2, but rather due to a buggy test case that got uncovered
from the change in behaviour in 06053689bed2.

The data_size of that test case for the skb was set to 1. In the
bpf_fill_ld_abs_vlan_push_pop() handler bpf insns are generated that
loop with: reading skb data, pushing 68 tags, reading skb data,
popping 68 tags, reading skb data, etc, in order to force a skb
expansion and thus trigger that JITs recache skb->data. Problem is
that initial data_size is too small.

While before 06053689bed2, the test silently bailed out due to the
skb->len < VLAN_ETH_HLEN check with returning 0, and now throwing an
error from failing skb_ensure_writable(). Set at least minimum of
ETH_HLEN as an initial length so that on first push of data, equivalent
pop will succeed.

Fixes: dd13879a8ed7 ("test_bpf: add bpf_skb_vlan_push/pop() tests")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
lib/test_bpf.c