android_kernel_motorola_sm6225/net/core
Eric Dumazet 2b601fcacd net: add atomic_long_t to net_device_stats fields
[ Upstream commit 6c1c5097781f563b70a81683ea6fdac21637573b ]

Long standing KCSAN issues are caused by data-race around
some dev->stats changes.

Most performance critical paths already use per-cpu
variables, or per-queue ones.

It is reasonable (and more correct) to use atomic operations
for the slow paths.

This patch adds an union for each field of net_device_stats,
so that we can convert paths that are not yet protected
by a spinlock or a mutex.

netdev_stats_to_stats64() no longer has an #if BITS_PER_LONG==64

Note that the memcpy() we were using on 64bit arches
had no provision to avoid load-tearing,
while atomic_long_read() is providing the needed protection
at no cost.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Stable-dep-of: 44bdb313da57 ("net: bridge: use DEV_STATS_INC()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-10-10 21:44:57 +02:00
..
datagram.c net: datagram: fix data-races in datagram_poll() 2023-05-30 12:42:08 +01:00
dev.c net: add atomic_long_t to net_device_stats fields 2023-10-10 21:44:57 +02:00
dev_addr_lists.c
dev_ioctl.c
devlink.c
drop_monitor.c
dst.c
dst_cache.c
ethtool.c net/ethtool/ioctl: return -EOPNOTSUPP if we have no phy stats 2023-01-24 07:11:49 +01:00
failover.c
fib_notifier.c
fib_rules.c
filter.c bpf: Always return target ifindex in bpf_fib_lookup 2023-02-22 12:47:19 +01:00
flow_dissector.c
gen_estimator.c
gen_stats.c
gro_cells.c
hwbm.c
link_watch.c
lwt_bpf.c
lwtunnel.c
Makefile
neighbour.c neighbour: delete neigh_lookup_nodev as not used 2023-06-21 15:39:59 +02:00
net-procfs.c
net-sysfs.c
net-sysfs.h
net-traces.c
net_namespace.c net: fix UaF in netns ops registration error path 2023-02-06 07:49:42 +01:00
netclassid_cgroup.c
netevent.c
netpoll.c net: don't let netpoll invoke NAPI if in xmit context 2023-04-20 12:04:38 +02:00
netprio_cgroup.c
page_pool.c
pktgen.c
ptp_classifier.c
request_sock.c
rtnetlink.c rtnetlink: Reject negative ifindexes in RTM_NEWLINK 2023-08-30 16:31:56 +02:00
scm.c
secure_seq.c
skbuff.c skbuff: skb_segment, Call zero copy functions before using skbuff frags 2023-09-23 10:48:09 +02:00
sock.c af_unix: Fix data race around sk->sk_err. 2023-09-23 10:48:13 +02:00
sock_diag.c
sock_reuseport.c
stream.c tcp: reduce POLLOUT events caused by TCP_NOTSENT_LOWAT 2023-05-30 12:42:07 +01:00
sysctl_net_core.c
timestamping.c
tso.c
utils.c
xdp.c