Eric Dumazet
840a647499
netlink: annotate accesses to nlk->cb_running
[ Upstream commit a939d14919b799e6fff8a9c80296ca229ba2f8a4 ]
Both netlink_recvmsg() and netlink_native_seq_show() read
nlk->cb_running locklessly. Use READ_ONCE() there.
Add corresponding WRITE_ONCE() to netlink_dump() and
__netlink_dump_start()
syzbot reported:
BUG: KCSAN: data-race in __netlink_dump_start / netlink_recvmsg
write to 0xffff88813ea4db59 of 1 bytes by task 28219 on cpu 0:
__netlink_dump_start+0x3af/0x4d0 net/netlink/af_netlink.c:2399
netlink_dump_start include/linux/netlink.h:308 [inline]
rtnetlink_rcv_msg+0x70f/0x8c0 net/core/rtnetlink.c:6130
netlink_rcv_skb+0x126/0x220 net/netlink/af_netlink.c:2577
rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:6192
netlink_unicast_kernel net/netlink/af_netlink.c:1339 [inline]
netlink_unicast+0x56f/0x640 net/netlink/af_netlink.c:1365
netlink_sendmsg+0x665/0x770 net/netlink/af_netlink.c:1942
sock_sendmsg_nosec net/socket.c:724 [inline]
sock_sendmsg net/socket.c:747 [inline]
sock_write_iter+0x1aa/0x230 net/socket.c:1138
call_write_iter include/linux/fs.h:1851 [inline]
new_sync_write fs/read_write.c:491 [inline]
vfs_write+0x463/0x760 fs/read_write.c:584
ksys_write+0xeb/0x1a0 fs/read_write.c:637
__do_sys_write fs/read_write.c:649 [inline]
__se_sys_write fs/read_write.c:646 [inline]
__x64_sys_write+0x42/0x50 fs/read_write.c:646
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
read to 0xffff88813ea4db59 of 1 bytes by task 28222 on cpu 1:
netlink_recvmsg+0x3b4/0x730 net/netlink/af_netlink.c:2022
sock_recvmsg_nosec+0x4c/0x80 net/socket.c:1017
____sys_recvmsg+0x2db/0x310 net/socket.c:2718
___sys_recvmsg net/socket.c:2762 [inline]
do_recvmmsg+0x2e5/0x710 net/socket.c:2856
__sys_recvmmsg net/socket.c:2935 [inline]
__do_sys_recvmmsg net/socket.c:2958 [inline]
__se_sys_recvmmsg net/socket.c:2951 [inline]
__x64_sys_recvmmsg+0xe2/0x160 net/socket.c:2951
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
value changed: 0x00 -> 0x01
Fixes: 16b304f340 ("netlink: Eliminate kmalloc in netlink dump operation.")
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-05-30 12:42:07 +01:00
..
2023-04-20 12:04:40 +02:00
2023-01-18 11:30:36 +01:00
2023-05-17 11:13:11 +02:00
2022-11-03 23:52:26 +09:00
2022-04-27 13:39:46 +02:00
2022-05-18 09:42:47 +02:00
2023-05-17 11:13:05 +02:00
2022-11-25 17:40:29 +01:00
2022-09-28 11:02:56 +02:00
2023-03-17 08:31:44 +01:00
2023-04-05 11:15:40 +02:00
2023-05-17 11:13:15 +02:00
2022-03-08 19:04:10 +01:00
2023-04-26 11:21:53 +02:00
2022-03-23 09:10:44 +01:00
2022-12-08 11:18:33 +01:00
2022-11-03 23:52:30 +09:00
2023-05-17 11:13:14 +02:00
2023-05-17 11:13:23 +02:00
2023-03-22 13:27:10 +01:00
2022-11-25 17:40:29 +01:00
2022-12-08 11:18:29 +01:00
2023-04-26 11:21:53 +02:00
2022-03-28 08:41:44 +02:00
2023-04-20 12:04:38 +02:00
2022-12-14 11:28:28 +01:00
2023-02-22 12:47:21 +01:00
2023-05-17 11:13:22 +02:00
2023-05-30 12:42:07 +01:00
2023-02-22 12:47:12 +01:00
2023-03-17 08:31:42 +01:00
2023-02-22 12:47:12 +01:00
2023-05-17 11:13:24 +02:00
2023-03-11 16:31:37 +01:00
2023-02-22 12:47:19 +01:00
2023-05-17 11:13:24 +02:00
2023-05-17 11:13:24 +02:00
2023-04-26 11:21:53 +02:00
2022-09-15 12:17:03 +02:00
2023-05-17 11:13:19 +02:00
2023-03-17 08:31:44 +01:00
2022-07-29 17:10:32 +02:00
2022-06-14 16:59:35 +02:00
2023-01-18 11:30:18 +01:00
2023-03-13 10:17:15 +01:00
2023-02-22 12:47:12 +01:00
2022-10-26 13:19:37 +02:00
2022-09-05 10:26:31 +02:00