]> git.baikalelectronics.ru Git - kernel.git/commit
tools: psock_lib: harden socket filter used by psock tests
authorSowmini Varadhan <sowmini.varadhan@oracle.com>
Thu, 12 Jan 2017 13:10:11 +0000 (05:10 -0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 12 Jan 2017 15:23:26 +0000 (10:23 -0500)
commit6182bd13b62a7f41cdf22cf864e2b092aad94cc0
tree9cf9841d98aa2b47e2b41ab5c6e2ed652d2cce80
parent1a78e9a1a7deb8fec7d9f7fdbb389b078fab9fc2
tools: psock_lib: harden socket filter used by psock tests

The filter added by sock_setfilter is intended to only permit
packets matching the pattern set up by create_payload(), but
we only check the ip_len, and a single test-character in
the IP packet to ensure this condition.

Harden the filter by adding additional constraints so that we only
permit UDP/IPv4 packets that meet the ip_len and test-character
requirements. Include the bpf_asm src as a comment, in case this
needs to be enhanced in the future

Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
tools/testing/selftests/net/psock_lib.h