]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
selftests/bpf: subtraction bounds test
authorEdward Cree <ecree@solarflare.com>
Fri, 21 Jul 2017 13:36:57 +0000 (14:36 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 24 Jul 2017 21:02:55 +0000 (14:02 -0700)
commit545722cb0fc993226a01844fb27cf832459eb1c0
tree4797885bb9959ee5a792938e42fa927522bf8719
parent70dba204a396c1c094749c4ef9bd27d5e8176a08
selftests/bpf: subtraction bounds test

There is a bug in the verifier's handling of BPF_SUB: [a,b] - [c,d] yields
 was [a-c, b-d] rather than the correct [a-d, b-c].  So here is a test
 which, with the bogus handling, will produce ranges of [0,0] and thus
 allowed accesses; whereas the correct handling will give a range of
 [-255, 255] (and hence the right-shift will give a range of [0, 255]) and
 the accesses will be rejected.

Signed-off-by: Edward Cree <ecree@solarflare.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
tools/testing/selftests/bpf/test_verifier.c