diff options
author | Willem de Bruijn | 2018-11-25 03:09:26 +0100 |
---|---|---|
committer | David S. Miller | 2018-11-25 03:22:21 +0100 |
commit | 358be656406dce296fafeac7a913ba33e9a66971 (patch) | |
tree | 11dcd5c0e1ebe476284d310dd60299be0ef5fae8 /tools/testing/selftests/net/run_afpackettests | |
parent | net: qualcomm: rmnet: move null check on dev before dereferecing it (diff) | |
download | kernel-qcow2-linux-358be656406dce296fafeac7a913ba33e9a66971.tar.gz kernel-qcow2-linux-358be656406dce296fafeac7a913ba33e9a66971.tar.xz kernel-qcow2-linux-358be656406dce296fafeac7a913ba33e9a66971.zip |
selftests/net: add txring_overwrite
Packet sockets with PACKET_TX_RING send skbs with user data in frags.
Before commit 5cd8d46ea156 ("packet: copy user buffers before orphan
or clone") ring slots could be released prematurely, possibly allowing
a process to overwrite data still in flight.
This test opens two packet sockets, one to send and one to read.
The sender has a tx ring of one slot. It sends two packets with
different payload, then reads both and verifies their payload.
Before the above commit, both receive calls return the same data as
the send calls use the same buffer. From the commit, the clone
needed for looping onto a packet socket triggers an skb_copy_ubufs
to create a private copy. The separate sends each arrive correctly.
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/testing/selftests/net/run_afpackettests')
-rwxr-xr-x | tools/testing/selftests/net/run_afpackettests | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/testing/selftests/net/run_afpackettests b/tools/testing/selftests/net/run_afpackettests index bea079edc278..2dc95fda7ef7 100755 --- a/tools/testing/selftests/net/run_afpackettests +++ b/tools/testing/selftests/net/run_afpackettests @@ -25,3 +25,13 @@ if [ $? -ne 0 ]; then else echo "[PASS]" fi + +echo "--------------------" +echo "running txring_overwrite test" +echo "--------------------" +./in_netns.sh ./txring_overwrite +if [ $? -ne 0 ]; then + echo "[FAIL]" +else + echo "[PASS]" +fi |