summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDaniel Borkmann <daniel@iogearbox.net>2016-10-20 17:13:53 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-01-11 13:37:11 +0100
commit26fe3eb871084f4e7f23ef8190b0333c0bd05e0b (patch)
treebe2f9cf6baa33b9d5c1e8bf75fef93937a70084a /lib
parent0dc4b955f01eae10c6923c86234ef9768137797f (diff)
downloadlinux-stable-26fe3eb871084f4e7f23ef8190b0333c0bd05e0b.tar.gz
linux-stable-26fe3eb871084f4e7f23ef8190b0333c0bd05e0b.tar.bz2
linux-stable-26fe3eb871084f4e7f23ef8190b0333c0bd05e0b.zip
bpf, test: fix ld_abs + vlan push/pop stress test
commit 0d906b1e8d4002cdd59590fec630f4e75023e288 upstream. After commit 636c2628086e ("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 636c2628086e, but rather due to a buggy test case that got uncovered from the change in behaviour in 636c2628086e. 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 636c2628086e, 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: 4d9c5c53ac99 ("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/test_bpf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/test_bpf.c b/lib/test_bpf.c
index cf2880d2ce3f..1a0d1e771e6c 100644
--- a/lib/test_bpf.c
+++ b/lib/test_bpf.c
@@ -4556,7 +4556,7 @@ static struct bpf_test tests[] = {
{ },
INTERNAL,
{ 0x34 },
- { { 1, 0xbef } },
+ { { ETH_HLEN, 0xbef } },
.fill_helper = bpf_fill_ld_abs_vlan_push_pop,
},
/*