Ubuntu-focal-kernel/net
Eric Dumazet b63fe61cdb net/packet: annotate accesses to po->ifindex
BugLink: https://bugs.launchpad.net/bugs/1936242

[ Upstream commit e032f7c9c7 ]

Like prior patch, we need to annotate lockless accesses to po->ifindex
For instance, packet_getname() is reading po->ifindex (twice) while
another thread is able to change po->ifindex.

KCSAN reported:

BUG: KCSAN: data-race in packet_do_bind / packet_getname

write to 0xffff888143ce3cbc of 4 bytes by task 25573 on cpu 1:
 packet_do_bind+0x420/0x7e0 net/packet/af_packet.c:3191
 packet_bind+0xc3/0xd0 net/packet/af_packet.c:3255
 __sys_bind+0x200/0x290 net/socket.c:1637
 __do_sys_bind net/socket.c:1648 [inline]
 __se_sys_bind net/socket.c:1646 [inline]
 __x64_sys_bind+0x3d/0x50 net/socket.c:1646
 do_syscall_64+0x4a/0x90 arch/x86/entry/common.c:47
 entry_SYSCALL_64_after_hwframe+0x44/0xae

read to 0xffff888143ce3cbc of 4 bytes by task 25578 on cpu 0:
 packet_getname+0x5b/0x1a0 net/packet/af_packet.c:3525
 __sys_getsockname+0x10e/0x1a0 net/socket.c:1887
 __do_sys_getsockname net/socket.c:1902 [inline]
 __se_sys_getsockname net/socket.c:1899 [inline]
 __x64_sys_getsockname+0x3e/0x50 net/socket.c:1899
 do_syscall_64+0x4a/0x90 arch/x86/entry/common.c:47
 entry_SYSCALL_64_after_hwframe+0x44/0xae

value changed: 0x00000000 -> 0x00000001

Reported by Kernel Concurrency Sanitizer on:
CPU: 0 PID: 25578 Comm: syz-executor.5 Not tainted 5.13.0-rc6-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
2021-08-13 09:44:20 +02:00
..
6lowpan
9p
802
8021q
appletalk appletalk: Fix skb allocation size in loopback case 2021-04-23 11:58:35 +02:00
atm
ax25
batman-adv batman-adv: Avoid WARN_ON timing related checks 2021-07-15 19:27:34 +02:00
bluetooth Bluetooth: use correct lock to prevent UAF of hdev object 2021-07-15 19:27:06 +02:00
bpf
bpfilter
bridge net: bridge: fix vlan tunnel dst refcnt when egressing 2021-07-15 19:27:46 +02:00
caif net: caif: fix memory leak in cfusbl_device_notify 2021-07-15 19:27:06 +02:00
can can: j1939: fix Use-after-Free, hold skb ref while in use 2021-07-15 19:27:42 +02:00
ceph
core net: ethtool: clear heap allocations for ethtool function 2021-08-13 09:44:18 +02:00
dcb
dccp ipv6: weaken the v4mapped source check 2021-04-23 11:58:31 +02:00
decnet
dns_resolver
dsa net: dsa: fix error code getting shifted with 4 in dsa_slave_get_sset_count 2021-06-18 15:02:54 +02:00
ethernet
hsr hsr: use netdev_err() instead of WARN_ONCE() 2021-05-26 15:39:02 +02:00
ieee802154 net: ieee802154: fix null deref in parse dev addr 2021-07-15 19:27:27 +02:00
ife
ipv4 ping: Check return value of function 'ping_queue_rcv_skb' 2021-08-13 09:44:18 +02:00
ipv6 net: ipv4: Remove unneed BUG() function 2021-08-13 09:44:17 +02:00
iucv net/af_iucv: remove WARN_ONCE on malformed RX packets 2021-04-14 18:31:44 +02:00
kcm
key af_key: relax availability checks for skb size calculation 2021-03-24 11:11:47 +01:00
l2tp
l3mdev
lapb net: lapb: Copy the skb before sending a packet 2021-03-24 11:11:38 +01:00
llc
mac80211 mac80211: drop multicast fragments 2021-08-13 09:44:18 +02:00
mac802154 net: mac802154: Fix general protection fault 2021-05-04 16:08:55 +02:00
mpls net: avoid infinite loop in mpls_gso_segment when mpls_hlen == 0 2021-04-14 18:31:51 +02:00
ncsi net/ncsi: Avoid channel_monitor hrtimer deadlock 2021-05-04 16:08:51 +02:00
netfilter netfilter: synproxy: Fix out of bounds when parsing TCP options 2021-07-15 19:27:36 +02:00
netlabel cipso,calipso: resolve a number of problems with the DOI refcounts 2021-04-14 18:31:53 +02:00
netlink netlink: disable IRQs for netlink_lock_table() 2021-07-15 19:27:14 +02:00
netrom
nfc net/nfc/rawsock.c: fix a permission check bug 2021-07-15 19:27:13 +02:00
nsh
openvswitch openvswitch: meter: fix race when getting now_ms. 2021-06-18 15:02:55 +02:00
packet net/packet: annotate accesses to po->ifindex 2021-08-13 09:44:20 +02:00
phonet
psample
qrtr net: qrtr: fix OOB Read in qrtr_endpoint_post 2021-07-15 19:27:38 +02:00
rds net: rds: fix memory leak in rds_recvmsg 2021-07-15 19:27:35 +02:00
rfkill
rose
rxrpc rxrpc: Fix clearance of Tx/Rx ring when releasing a call 2021-03-24 11:14:33 +01:00
sched sch_cake: Fix out of bounds when parsing TCP options and header 2021-07-15 19:27:36 +02:00
sctp sctp: fix a SCTP_MIB_CURRESTAB leak in sctp_sf_do_dupcook_b 2021-06-18 15:02:14 +02:00
smc Revert "net/smc: fix a NULL pointer dereference" 2021-06-18 15:02:49 +02:00
strparser
sunrpc sunrpc: Fix misplaced barrier in call_decode 2021-06-18 15:02:14 +02:00
switchdev
tipc tipc: fix unique bearer names sanity check 2021-07-15 19:27:05 +02:00
tls tls splice: check SPLICE_F_NONBLOCK instead of MSG_DONTWAIT 2021-06-18 15:02:55 +02:00
unix net/af_unix: fix a data-race in unix_dgram_sendmsg / unix_release_sock 2021-07-15 19:27:39 +02:00
vmw_vsock vsock/vmci: log once the failed queue pair allocation 2021-05-26 15:39:22 +02:00
wimax
wireless cfg80211: call cfg80211_leave_ocb when switching away from OCB 2021-08-13 09:44:16 +02:00
x25 net/x25: Return the correct errno code 2021-07-15 19:27:31 +02:00
xdp xsk: Simplify detection of empty and full rings 2021-06-18 15:02:23 +02:00
xfrm net: xfrm: Localize sequence counter per network namespace 2021-05-04 16:08:49 +02:00
Kconfig
Makefile
compat.c net: Return the correct errno code 2021-07-15 19:27:31 +02:00
socket.c net: make get_net_ns return error if NET_NS is disabled 2021-07-15 19:27:37 +02:00
sysctl_net.c