selftests/bpf: don't try to access past MAX_PACKET_OFF in test_verifier
authorEdward Cree <ecree@solarflare.com>
Mon, 7 Aug 2017 14:29:11 +0000 (15:29 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 9 Aug 2017 00:51:35 +0000 (17:51 -0700)
commit1f9ab38f8a155913c9a587a673e61eedb75c9bc8
tree413ab94b9a98d08a7b9055758ef02f368f5425d1
parentc2c3e11712e23d430a49e1247a8ec211740c2254
selftests/bpf: don't try to access past MAX_PACKET_OFF in test_verifier

A number of selftests fell foul of the changed MAX_PACKET_OFF handling.
For instance, "direct packet access: test2" was potentially reading four
 bytes from pkt + 0xffff, which could take it past the verifier's limit,
 causing the program to be rejected (checks against pkt_end didn't give
 us any reg->range).
Increase the shifts by one so that R2 is now mask 0x7fff instead of
 mask 0xffff.

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