Eric Dumazet
4ba4eec4f4
xfrm: interface: use DEV_STATS_INC()
...
commit f7c4e3e5d4f6609b4725a97451948ca2e425379a upstream.
syzbot/KCSAN reported data-races in xfrm whenever dev->stats fields
are updated.
It appears all of these updates can happen from multiple cpus.
Adopt SMP safe DEV_STATS_INC() to update dev->stats fields.
BUG: KCSAN: data-race in xfrmi_xmit / xfrmi_xmit
read-write to 0xffff88813726b160 of 8 bytes by task 23986 on cpu 1:
xfrmi_xmit+0x74e/0xb20 net/xfrm/xfrm_interface_core.c:583
__netdev_start_xmit include/linux/netdevice.h:4889 [inline]
netdev_start_xmit include/linux/netdevice.h:4903 [inline]
xmit_one net/core/dev.c:3544 [inline]
dev_hard_start_xmit+0x11b/0x3f0 net/core/dev.c:3560
__dev_queue_xmit+0xeee/0x1de0 net/core/dev.c:4340
dev_queue_xmit include/linux/netdevice.h:3082 [inline]
neigh_connected_output+0x231/0x2a0 net/core/neighbour.c:1581
neigh_output include/net/neighbour.h:542 [inline]
ip_finish_output2+0x74a/0x850 net/ipv4/ip_output.c:230
ip_finish_output+0xf4/0x240 net/ipv4/ip_output.c:318
NF_HOOK_COND include/linux/netfilter.h:293 [inline]
ip_output+0xe5/0x1b0 net/ipv4/ip_output.c:432
dst_output include/net/dst.h:458 [inline]
ip_local_out net/ipv4/ip_output.c:127 [inline]
ip_send_skb+0x72/0xe0 net/ipv4/ip_output.c:1487
udp_send_skb+0x6a4/0x990 net/ipv4/udp.c:963
udp_sendmsg+0x1249/0x12d0 net/ipv4/udp.c:1246
inet_sendmsg+0x63/0x80 net/ipv4/af_inet.c:840
sock_sendmsg_nosec net/socket.c:730 [inline]
sock_sendmsg net/socket.c:753 [inline]
____sys_sendmsg+0x37c/0x4d0 net/socket.c:2540
___sys_sendmsg net/socket.c:2594 [inline]
__sys_sendmmsg+0x269/0x500 net/socket.c:2680
__do_sys_sendmmsg net/socket.c:2709 [inline]
__se_sys_sendmmsg net/socket.c:2706 [inline]
__x64_sys_sendmmsg+0x57/0x60 net/socket.c:2706
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-write to 0xffff88813726b160 of 8 bytes by task 23987 on cpu 0:
xfrmi_xmit+0x74e/0xb20 net/xfrm/xfrm_interface_core.c:583
__netdev_start_xmit include/linux/netdevice.h:4889 [inline]
netdev_start_xmit include/linux/netdevice.h:4903 [inline]
xmit_one net/core/dev.c:3544 [inline]
dev_hard_start_xmit+0x11b/0x3f0 net/core/dev.c:3560
__dev_queue_xmit+0xeee/0x1de0 net/core/dev.c:4340
dev_queue_xmit include/linux/netdevice.h:3082 [inline]
neigh_connected_output+0x231/0x2a0 net/core/neighbour.c:1581
neigh_output include/net/neighbour.h:542 [inline]
ip_finish_output2+0x74a/0x850 net/ipv4/ip_output.c:230
ip_finish_output+0xf4/0x240 net/ipv4/ip_output.c:318
NF_HOOK_COND include/linux/netfilter.h:293 [inline]
ip_output+0xe5/0x1b0 net/ipv4/ip_output.c:432
dst_output include/net/dst.h:458 [inline]
ip_local_out net/ipv4/ip_output.c:127 [inline]
ip_send_skb+0x72/0xe0 net/ipv4/ip_output.c:1487
udp_send_skb+0x6a4/0x990 net/ipv4/udp.c:963
udp_sendmsg+0x1249/0x12d0 net/ipv4/udp.c:1246
inet_sendmsg+0x63/0x80 net/ipv4/af_inet.c:840
sock_sendmsg_nosec net/socket.c:730 [inline]
sock_sendmsg net/socket.c:753 [inline]
____sys_sendmsg+0x37c/0x4d0 net/socket.c:2540
___sys_sendmsg net/socket.c:2594 [inline]
__sys_sendmmsg+0x269/0x500 net/socket.c:2680
__do_sys_sendmmsg net/socket.c:2709 [inline]
__se_sys_sendmmsg net/socket.c:2706 [inline]
__x64_sys_sendmmsg+0x57/0x60 net/socket.c:2706
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: 0x00000000000010d7 -> 0x00000000000010d8
Reported by Kernel Concurrency Sanitizer on:
CPU: 0 PID: 23987 Comm: syz-executor.5 Not tainted 6.5.0-syzkaller-10885-g0468be89b3fa #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/26/2023
Fixes: f203b76d7809 ("xfrm: Add virtual xfrm interfaces")
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-25 11:54:19 +02:00
..
2021-09-15 09:50:34 +02:00
2023-09-19 12:20:04 +02:00
2023-01-14 10:16:18 +01:00
2023-05-30 12:57:53 +01:00
2023-06-09 10:30:12 +02:00
2022-06-22 14:13:17 +02:00
2023-08-30 16:23:16 +02:00
2023-10-25 11:54:18 +02:00
2023-01-14 10:15:31 +01:00
2021-07-14 16:56:29 +02:00
2023-10-10 21:53:28 +02:00
2023-03-17 08:45:11 +01:00
2023-07-27 08:44:35 +02:00
2023-10-25 11:54:15 +02:00
2023-10-10 21:53:38 +02:00
2023-08-11 11:57:50 +02:00
2023-10-10 21:53:27 +02:00
2023-06-21 15:45:38 +02:00
2023-07-27 08:44:10 +02:00
2023-01-24 07:19:55 +01:00
2023-09-19 12:20:29 +02:00
2022-11-03 23:57:51 +09:00
2023-10-25 11:54:19 +02:00
2023-10-25 11:54:14 +02:00
2023-03-22 13:30:00 +01:00
2023-09-19 12:20:30 +02:00
2023-08-26 15:26:51 +02:00
2023-10-10 21:53:38 +02:00
2022-04-27 13:53:50 +02:00
2023-07-27 08:44:40 +02:00
2023-05-30 12:57:53 +01:00
2022-12-14 11:32:01 +01:00
2023-02-22 12:55:58 +01:00
2023-04-26 11:27:41 +02:00
2023-10-10 21:53:33 +02:00
2023-10-25 11:54:19 +02:00
2023-09-19 12:20:05 +02:00
2023-07-27 08:43:43 +02:00
2023-09-19 12:20:10 +02:00
2023-10-25 11:54:19 +02:00
2023-05-30 12:57:52 +01:00
2023-02-22 12:55:57 +01:00
2023-08-16 18:21:01 +02:00
2022-01-11 15:25:01 +01:00
2023-04-20 12:10:26 +02:00
2023-10-25 11:54:13 +02:00
2023-02-22 12:55:53 +01:00
2023-05-17 11:48:11 +02:00
2023-09-23 11:01:10 +02:00
2023-10-10 21:53:39 +02:00
2023-09-19 12:20:29 +02:00
2021-11-18 14:04:27 +01:00
2023-10-10 21:53:35 +02:00
2023-10-10 21:53:38 +02:00
2023-09-19 12:20:30 +02:00
2023-09-19 12:20:26 +02:00
2023-05-30 12:57:52 +01:00
2023-08-11 11:57:47 +02:00
2023-02-15 17:22:15 +01:00
2023-07-27 08:44:09 +02:00
2023-10-25 11:54:19 +02:00
2021-06-18 10:00:06 +02:00
2023-06-21 15:45:38 +02:00
2023-06-21 15:45:38 +02:00
2023-10-25 11:54:13 +02:00