mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-13 09:15:02 +08:00
358be65640
Packet sockets with PACKET_TX_RING send skbs with user data in frags.
Before commit 5cd8d46ea1
("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>
25 lines
975 B
Makefile
25 lines
975 B
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
# Makefile for net selftests
|
|
|
|
CFLAGS = -Wall -Wl,--no-as-needed -O2 -g
|
|
CFLAGS += -I../../../../usr/include/
|
|
|
|
TEST_PROGS := run_netsocktests run_afpackettests test_bpf.sh netdevice.sh rtnetlink.sh
|
|
TEST_PROGS += fib_tests.sh fib-onlink-tests.sh pmtu.sh udpgso.sh ip_defrag.sh
|
|
TEST_PROGS += udpgso_bench.sh fib_rule_tests.sh msg_zerocopy.sh psock_snd.sh
|
|
TEST_PROGS += udpgro_bench.sh udpgro.sh
|
|
TEST_PROGS_EXTENDED := in_netns.sh
|
|
TEST_GEN_FILES = socket
|
|
TEST_GEN_FILES += psock_fanout psock_tpacket msg_zerocopy
|
|
TEST_GEN_FILES += tcp_mmap tcp_inq psock_snd txring_overwrite
|
|
TEST_GEN_FILES += udpgso udpgso_bench_tx udpgso_bench_rx ip_defrag
|
|
TEST_GEN_PROGS = reuseport_bpf reuseport_bpf_cpu reuseport_bpf_numa
|
|
TEST_GEN_PROGS += reuseport_dualstack reuseaddr_conflict tls
|
|
|
|
KSFT_KHDR_INSTALL := 1
|
|
include ../lib.mk
|
|
|
|
$(OUTPUT)/reuseport_bpf_numa: LDFLAGS += -lnuma
|
|
$(OUTPUT)/tcp_mmap: LDFLAGS += -lpthread
|
|
$(OUTPUT)/tcp_inq: LDFLAGS += -lpthread
|