Eric Dumazet
d11109c03d
ip_tunnels: use DEV_STATS_INC()
[ Upstream commit 9b271ebaf9 ]
syzbot/KCSAN reported data-races in iptunnel_xmit_stats() [1]
This can run from multiple cpus without mutual exclusion.
Adopt SMP safe DEV_STATS_INC() to update dev->stats fields.
[1]
BUG: KCSAN: data-race in iptunnel_xmit / iptunnel_xmit
read-write to 0xffff8881353df170 of 8 bytes by task 30263 on cpu 1:
iptunnel_xmit_stats include/net/ip_tunnels.h:493 [inline]
iptunnel_xmit+0x432/0x4a0 net/ipv4/ip_tunnel_core.c:87
ip_tunnel_xmit+0x1477/0x1750 net/ipv4/ip_tunnel.c:831
__gre_xmit net/ipv4/ip_gre.c:469 [inline]
ipgre_xmit+0x516/0x570 net/ipv4/ip_gre.c:662
__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]
__bpf_tx_skb net/core/filter.c:2129 [inline]
__bpf_redirect_no_mac net/core/filter.c:2159 [inline]
__bpf_redirect+0x723/0x9c0 net/core/filter.c:2182
____bpf_clone_redirect net/core/filter.c:2453 [inline]
bpf_clone_redirect+0x16c/0x1d0 net/core/filter.c:2425
___bpf_prog_run+0xd7d/0x41e0 kernel/bpf/core.c:1954
__bpf_prog_run512+0x74/0xa0 kernel/bpf/core.c:2195
bpf_dispatcher_nop_func include/linux/bpf.h:1181 [inline]
__bpf_prog_run include/linux/filter.h:609 [inline]
bpf_prog_run include/linux/filter.h:616 [inline]
bpf_test_run+0x15d/0x3d0 net/bpf/test_run.c:423
bpf_prog_test_run_skb+0x77b/0xa00 net/bpf/test_run.c:1045
bpf_prog_test_run+0x265/0x3d0 kernel/bpf/syscall.c:3996
__sys_bpf+0x3af/0x780 kernel/bpf/syscall.c:5353
__do_sys_bpf kernel/bpf/syscall.c:5439 [inline]
__se_sys_bpf kernel/bpf/syscall.c:5437 [inline]
__x64_sys_bpf+0x43/0x50 kernel/bpf/syscall.c:5437
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 0xffff8881353df170 of 8 bytes by task 30249 on cpu 0:
iptunnel_xmit_stats include/net/ip_tunnels.h:493 [inline]
iptunnel_xmit+0x432/0x4a0 net/ipv4/ip_tunnel_core.c:87
ip_tunnel_xmit+0x1477/0x1750 net/ipv4/ip_tunnel.c:831
__gre_xmit net/ipv4/ip_gre.c:469 [inline]
ipgre_xmit+0x516/0x570 net/ipv4/ip_gre.c:662
__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]
__bpf_tx_skb net/core/filter.c:2129 [inline]
__bpf_redirect_no_mac net/core/filter.c:2159 [inline]
__bpf_redirect+0x723/0x9c0 net/core/filter.c:2182
____bpf_clone_redirect net/core/filter.c:2453 [inline]
bpf_clone_redirect+0x16c/0x1d0 net/core/filter.c:2425
___bpf_prog_run+0xd7d/0x41e0 kernel/bpf/core.c:1954
__bpf_prog_run512+0x74/0xa0 kernel/bpf/core.c:2195
bpf_dispatcher_nop_func include/linux/bpf.h:1181 [inline]
__bpf_prog_run include/linux/filter.h:609 [inline]
bpf_prog_run include/linux/filter.h:616 [inline]
bpf_test_run+0x15d/0x3d0 net/bpf/test_run.c:423
bpf_prog_test_run_skb+0x77b/0xa00 net/bpf/test_run.c:1045
bpf_prog_test_run+0x265/0x3d0 kernel/bpf/syscall.c:3996
__sys_bpf+0x3af/0x780 kernel/bpf/syscall.c:5353
__do_sys_bpf kernel/bpf/syscall.c:5439 [inline]
__se_sys_bpf kernel/bpf/syscall.c:5437 [inline]
__x64_sys_bpf+0x43/0x50 kernel/bpf/syscall.c:5437
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: 0x0000000000018830 -> 0x0000000000018831
Reported by Kernel Concurrency Sanitizer on:
CPU: 0 PID: 30249 Comm: syz-executor.4 Not tainted 6.5.0-syzkaller-11704-g3f86ed6ec0b3 #0
Fixes: 039f50629b ("ip_tunnel: Move stats update to iptunnel_xmit()")
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-09-19 12:22:59 +02:00
..
2022-08-17 14:24:07 +02:00
2022-08-03 12:03:40 +02:00
2021-07-01 13:19:48 -07:00
2021-01-28 20:36:21 -08:00
2023-08-16 18:22:03 +02:00
2023-06-21 15:59:15 +02:00
2021-11-25 09:48:40 +01:00
2019-06-05 17:37:07 +02:00
2023-03-11 13:57:28 +01:00
2023-03-11 13:57:29 +01:00
2020-02-28 14:51:30 +01:00
2021-08-02 10:24:38 +01:00
2022-08-03 12:03:47 +02:00
2019-05-30 11:26:41 -07:00
2021-04-23 10:17:26 +01:00
2021-08-16 18:43:39 -07:00
2022-03-23 09:16:41 +01:00
2017-11-02 11:10:55 +01:00
2022-04-13 20:59:05 +02:00
2017-11-02 11:10:55 +01:00
2022-04-20 09:34:22 +02:00
2021-08-03 13:05:25 +01:00
2020-07-21 18:30:47 -07:00
2022-09-28 11:11:48 +02:00
2023-06-14 11:13:00 +02:00
2023-06-05 09:21:19 +02:00
2023-08-30 16:18:15 +02:00
2021-03-26 17:43:55 +01:00
2022-08-31 17:16:43 +02:00
2019-05-21 11:28:45 +02:00
2019-06-19 17:09:55 +02:00
2023-08-16 18:22:01 +02:00
2020-02-29 14:39:08 +01:00
2022-03-02 11:47:58 +01:00
2020-07-15 07:45:24 -07:00
2020-03-27 19:40:38 -07:00
2016-06-25 12:19:35 -04:00
2021-08-05 11:46:42 +01:00
2017-11-02 11:10:55 +01:00
2019-05-30 11:29:52 -07:00
2019-05-30 11:29:52 -07:00
2021-08-14 13:59:10 +01:00
2023-06-05 09:21:17 +02:00
2019-12-16 16:09:44 -08:00
2021-12-08 09:04:46 +01:00
2022-02-16 12:56:30 +01:00
2020-05-08 21:33:33 -07:00
2023-06-21 15:59:19 +02:00
2020-05-05 13:23:29 -07:00
2022-04-27 14:38:52 +02:00
2020-04-20 07:34:16 +02:00
2019-06-19 17:09:55 +02:00
2018-05-28 22:59:54 -04:00
2019-12-24 22:37:30 -08:00
2021-12-08 09:04:43 +01:00
2017-11-02 11:10:55 +01:00
2022-04-20 09:34:09 +02:00
2022-06-14 18:36:17 +02:00
2023-06-21 15:59:19 +02:00
2017-11-02 11:10:55 +01:00
2021-01-21 13:33:45 +01:00
2021-01-21 13:33:45 +01:00
2019-12-09 10:36:44 -08:00
2019-11-05 18:20:55 -08:00
2021-02-12 16:31:46 -08:00
2019-03-22 12:09:31 -07:00
2021-01-29 20:39:14 -08:00
2017-11-02 11:10:55 +01:00
2021-03-18 19:51:12 -07:00
2017-11-02 11:10:55 +01:00
2020-06-22 21:12:44 -07:00
2019-10-25 16:24:32 -07:00
2021-06-28 14:29:45 -07:00
2021-08-13 09:58:25 +02:00
2022-10-26 12:35:54 +02:00
2022-06-09 10:22:31 +02:00
2019-04-22 21:50:53 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2022-08-17 14:23:36 +02:00
2021-01-27 18:18:15 -08:00
2022-08-03 12:03:45 +02:00
2020-12-14 18:38:58 -08:00
2022-01-27 11:05:35 +01:00
2022-08-17 14:23:36 +02:00
2022-08-17 14:23:36 +02:00
2019-09-27 12:05:02 +02:00
2019-02-08 21:50:15 -08:00
2021-07-21 08:14:33 -07:00
2020-06-20 17:47:53 -07:00
2023-09-19 12:22:58 +02:00
2021-08-05 15:08:47 -07:00
2022-05-09 09:14:36 +02:00
2023-09-19 12:22:58 +02:00
2023-09-19 12:22:59 +02:00
2023-05-24 17:36:46 +01:00
2023-09-19 12:22:58 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2022-01-27 11:05:35 +01:00
2021-12-01 09:04:49 +01:00
2023-08-03 10:22:34 +02:00
2018-03-27 09:51:23 +02:00
2019-06-19 17:09:55 +02:00
2020-06-20 17:22:22 -07:00
2018-07-11 23:10:19 -07:00
2021-03-23 14:14:50 -07:00
2017-11-02 11:10:55 +01:00
2017-10-25 12:06:25 +09:00
2019-10-08 13:23:05 -07:00
2021-07-27 13:05:56 +01:00
2021-11-18 19:17:10 +01:00
2023-09-19 12:22:34 +02:00
2021-09-27 12:02:54 +02:00
2019-05-30 11:26:41 -07:00
2021-06-24 12:41:12 -07:00
2021-10-18 13:47:09 +01:00
2021-08-25 11:23:14 +01:00
2020-03-02 11:16:27 -08:00
2021-03-26 15:14:56 -07:00
2020-02-28 12:08:37 -08:00
2020-05-29 21:20:20 -07:00
2023-01-12 11:58:52 +01:00
2022-12-31 13:14:42 +01:00
2017-11-02 11:10:55 +01:00
2022-03-08 19:12:33 +01:00
2023-06-21 15:59:19 +02:00
2018-05-28 22:59:54 -04:00
2022-04-13 20:59:03 +02:00
2017-11-02 11:10:55 +01:00
2018-08-01 09:52:30 -07:00
2019-05-21 11:28:45 +02:00
2021-07-27 11:43:50 +01:00
2019-11-12 08:18:03 -08:00
2019-04-11 13:59:49 -07:00
2021-09-24 14:07:10 +01:00
2021-12-01 09:04:46 +01:00
2017-11-08 16:12:33 +09:00
2017-11-02 11:10:55 +01:00
2023-06-05 09:21:22 +02:00
2020-03-04 13:25:55 -08:00
2019-05-30 11:26:32 -07:00
2021-08-30 16:33:59 -07:00
2023-07-23 13:47:45 +02:00
2017-11-02 11:10:55 +01:00
2022-11-10 18:15:38 +01:00
2021-08-09 15:34:21 -07:00
2017-11-02 11:10:55 +01:00
2022-07-21 21:24:27 +02:00
2017-11-02 11:10:55 +01:00
2021-03-25 17:40:43 -07:00
2020-07-31 09:24:23 +02:00
2020-08-24 14:35:00 -07:00
2018-05-16 07:23:35 +02:00
2022-07-29 17:25:09 +02:00
2023-06-14 11:13:02 +02:00
2018-03-13 18:37:02 +02:00
2023-08-30 16:18:14 +02:00
2019-04-22 21:47:25 -07:00
2023-02-01 08:27:09 +01:00
2023-05-11 23:00:26 +09:00
2022-05-18 10:26:53 +02:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2022-01-27 11:05:05 +01:00
2021-04-28 14:06:45 -07:00
2018-04-11 10:33:46 -04:00
2020-09-28 15:19:03 -07:00
2019-10-05 16:29:00 -07:00
2022-12-31 13:14:07 +01:00
2023-08-30 16:18:13 +02:00
2021-08-03 13:05:26 +01:00
2017-11-02 11:10:55 +01:00
2021-11-18 19:17:11 +01:00
2021-08-04 12:35:07 +01:00
2019-05-30 11:26:32 -07:00
2023-09-19 12:22:32 +02:00
2019-05-30 11:26:32 -07:00
2018-05-08 00:02:41 -04:00
2019-10-04 14:07:07 -07:00
2023-08-26 14:23:22 +02:00
2020-06-23 20:10:15 -07:00
2020-06-18 20:46:23 -07:00
2017-08-29 15:16:52 -07:00
2022-09-15 11:30:05 +02:00
2023-04-26 13:51:54 +02:00
2023-04-26 13:51:54 +02:00
2019-11-14 18:12:17 -08:00
2023-08-11 15:13:54 +02:00
2018-01-24 19:13:45 -05:00
2019-12-09 10:28:43 -08:00
2017-11-02 11:10:55 +01:00
2019-11-16 12:39:10 -08:00
2022-06-14 18:36:18 +02:00
2021-06-24 19:41:15 +02:00
2023-06-05 09:21:21 +02:00
2023-06-28 10:29:45 +02:00
2023-05-11 23:00:27 +09:00