Kuniyuki Iwashima
d7343f8de0
net: Fix load-tearing on sk->sk_stamp in sock_recv_cmsgs().
[ Upstream commit dfd9248c07 ]
KCSAN found a data race in sock_recv_cmsgs() where the read access
to sk->sk_stamp needs READ_ONCE().
BUG: KCSAN: data-race in packet_recvmsg / packet_recvmsg
write (marked) to 0xffff88803c81f258 of 8 bytes by task 19171 on cpu 0:
sock_write_timestamp include/net/sock.h:2670 [inline]
sock_recv_cmsgs include/net/sock.h:2722 [inline]
packet_recvmsg+0xb97/0xd00 net/packet/af_packet.c:3489
sock_recvmsg_nosec net/socket.c:1019 [inline]
sock_recvmsg+0x11a/0x130 net/socket.c:1040
sock_read_iter+0x176/0x220 net/socket.c:1118
call_read_iter include/linux/fs.h:1845 [inline]
new_sync_read fs/read_write.c:389 [inline]
vfs_read+0x5e0/0x630 fs/read_write.c:470
ksys_read+0x163/0x1a0 fs/read_write.c:613
__do_sys_read fs/read_write.c:623 [inline]
__se_sys_read fs/read_write.c:621 [inline]
__x64_sys_read+0x41/0x50 fs/read_write.c:621
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3b/0x90 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x72/0xdc
read to 0xffff88803c81f258 of 8 bytes by task 19183 on cpu 1:
sock_recv_cmsgs include/net/sock.h:2721 [inline]
packet_recvmsg+0xb64/0xd00 net/packet/af_packet.c:3489
sock_recvmsg_nosec net/socket.c:1019 [inline]
sock_recvmsg+0x11a/0x130 net/socket.c:1040
sock_read_iter+0x176/0x220 net/socket.c:1118
call_read_iter include/linux/fs.h:1845 [inline]
new_sync_read fs/read_write.c:389 [inline]
vfs_read+0x5e0/0x630 fs/read_write.c:470
ksys_read+0x163/0x1a0 fs/read_write.c:613
__do_sys_read fs/read_write.c:623 [inline]
__se_sys_read fs/read_write.c:621 [inline]
__x64_sys_read+0x41/0x50 fs/read_write.c:621
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3b/0x90 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x72/0xdc
value changed: 0xffffffffc4653600 -> 0x0000000000000000
Reported by Kernel Concurrency Sanitizer on:
CPU: 1 PID: 19183 Comm: syz-executor.5 Not tainted 6.3.0-rc7-02330-gca6270c12e20 #2
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
Fixes: 6c7c98bad4 ("sock: avoid dirtying sk_stamp, if possible")
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://lore.kernel.org/r/20230508175543.55756-1-kuniyu@amazon.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-05-30 12:44:01 +01:00
..
2019-05-30 11:29:21 -07:00
2022-08-03 11:59:37 +02:00
2021-06-10 13:37:09 +02:00
2018-09-26 09:56:07 -07:00
2023-05-17 11:35:57 +02:00
2021-12-08 09:01:12 +01:00
2021-12-01 09:23:35 +01:00
2019-06-05 17:37:07 +02:00
2023-03-11 16:44:11 +01:00
2022-05-18 09:47:25 +02:00
2017-04-12 22:02:36 +02:00
2021-03-04 10:26:53 +01:00
2022-08-03 11:59:39 +02:00
2019-05-30 11:26:41 -07:00
2020-09-09 19:12:23 +02:00
2019-02-28 08:24:23 -07:00
2019-06-05 17:37:05 +02:00
2017-11-02 11:10:55 +01:00
2022-04-15 14:18:33 +02:00
2017-11-02 11:10:55 +01:00
2022-04-20 09:19:39 +02:00
2019-06-19 17:09:55 +02:00
2022-02-23 11:59:58 +01:00
2021-12-14 14:49:00 +01:00
2019-07-04 12:30:48 -07:00
2023-01-18 11:41:05 +01:00
2019-08-17 23:18:54 +02:00
2022-09-05 10:27:42 +02:00
2019-05-21 11:28:45 +02:00
2019-06-19 17:09:55 +02:00
2021-06-03 08:59:01 +02:00
2019-05-30 11:26:41 -07:00
2022-03-02 11:41:08 +01:00
2019-05-21 11:28:45 +02:00
2019-05-30 11:26:32 -07:00
2016-04-25 16:44:27 -04:00
2016-06-25 12:19:35 -04:00
2016-04-25 16:44:27 -04:00
2019-04-19 14:07:40 -07: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
2019-11-09 19:38:36 -08:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2019-05-21 11:52:39 +02:00
2019-05-21 11:52:39 +02:00
2017-11-04 09:26:51 +09:00
2020-05-27 17:46:24 +02:00
2019-09-16 21:32:57 +02:00
2017-11-02 11:10:55 +01:00
2018-03-05 12:52:45 -05:00
2022-02-16 12:52:51 +01:00
2020-01-04 19:18:58 +01:00
2023-01-18 11:41:37 +01:00
2018-05-20 18:31:42 -04:00
2022-07-12 16:30:45 +02:00
2019-06-19 17:09:55 +02:00
2018-05-28 22:59:54 -04:00
2019-04-22 21:50:53 -07:00
2021-12-08 09:01:13 +01:00
2017-11-02 11:10:55 +01:00
2022-04-20 09:19:34 +02:00
2019-12-18 16:08:47 +01:00
2020-09-26 18:03:12 +02:00
2017-11-02 11:10:55 +01:00
2019-11-08 09:11:49 +01:00
2019-10-23 20:13:22 -07:00
2017-11-02 11:10:55 +01:00
2018-11-17 21:37:29 -08:00
2020-07-22 09:32:46 +02:00
2019-03-22 12:09:31 -07:00
2018-12-10 15:53:04 -08:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2019-07-01 10:58:23 -07:00
2019-10-25 16:24:32 -07:00
2021-03-04 10:26:53 +01:00
2019-02-22 12:56:24 -08:00
2022-10-26 13:22:59 +02:00
2022-06-14 18:11:25 +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
2019-05-30 11:26:32 -07:00
2019-07-03 13:51:54 -07:00
2021-03-30 14:35:26 +02:00
2020-12-08 10:40:25 +01:00
2022-01-27 09:19:54 +01:00
2022-06-06 08:33:49 +02:00
2022-07-29 17:14:11 +02:00
2019-09-27 12:05:02 +02:00
2019-02-08 21:50:15 -08:00
2019-05-30 11:26:32 -07:00
2022-02-01 17:24:38 +01:00
2021-08-12 13:20:57 +02:00
2019-06-18 20:48:45 -04:00
2021-12-08 09:01:12 +01:00
2020-11-24 13:29:05 +01:00
2020-08-19 08:16:10 +02:00
2022-07-29 17:14:11 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2022-01-27 09:19:54 +01:00
2021-12-01 09:23:33 +01:00
2023-04-26 11:24:05 +02:00
2020-02-11 04:35:48 -08:00
2018-03-27 09:51:23 +02:00
2019-06-19 17:09:55 +02:00
2019-05-30 11:26:32 -07:00
2018-07-11 23:10:19 -07:00
2017-11-02 11:10:55 +01: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-08-04 12:27:39 +02:00
2014-12-10 15:21:24 -05:00
2021-11-17 09:48:47 +01:00
2019-04-23 19:42:29 -07:00
2020-04-29 16:33:18 +02:00
2019-05-30 11:26:41 -07:00
2019-05-21 11:28:45 +02:00
2017-11-02 11:10:55 +01:00
2019-06-05 17:36:38 +02:00
2019-06-05 17:36:38 +02:00
2023-01-18 11:41:37 +01:00
2017-11-02 11:10:55 +01:00
2019-12-31 16:45:03 +01:00
2021-11-17 09:48:49 +01:00
2018-05-28 22:59:54 -04:00
2021-06-23 14:41:25 +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
2019-08-13 20:37:16 -07:00
2019-05-30 11:26:32 -07:00
2019-04-11 13:59:49 -07:00
2021-10-06 15:42:33 +02:00
2021-12-01 09:23:32 +01:00
2017-11-08 16:12:33 +09:00
2017-11-02 11:10:55 +01:00
2021-05-19 10:08:31 +02:00
2019-05-30 11:26:32 -07:00
2020-02-01 09:34:38 +00:00
2021-10-17 10:42:34 +02:00
2017-11-02 11:10:55 +01:00
2022-11-10 17:57:55 +01:00
2021-08-18 08:56:59 +02:00
2017-11-02 11:10:55 +01:00
2022-07-21 20:59:22 +02:00
2017-11-02 11:10:55 +01:00
2021-04-14 08:24:14 +02:00
2018-08-28 11:11:47 +02:00
2019-10-09 21:34:31 -07:00
2018-05-16 07:23:35 +02:00
2022-02-01 17:24:39 +01:00
2018-03-13 18:37:02 +02:00
2021-03-30 14:35:29 +02:00
2019-04-22 21:47:25 -07:00
2023-02-06 07:52:37 +01:00
2023-05-17 11:35:41 +02:00
2022-06-06 08:33:49 +02:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2018-04-11 10:33:46 -04:00
2019-02-21 10:34:37 -08:00
2019-05-30 11:26:32 -07:00
2019-09-16 09:02:18 +02:00
2023-05-30 12:44:01 +01:00
2018-03-01 21:21:36 -05:00
2017-11-02 11:10:55 +01:00
2021-11-17 09:48:48 +01:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2022-11-10 17:57:55 +01:00
2019-05-30 11:26:32 -07:00
2018-05-08 00:02:41 -04:00
2021-11-02 19:46:12 +01:00
2018-07-07 10:58:49 +09:00
2017-11-02 11:10:55 +01:00
2017-08-29 15:16:52 -07:00
2022-04-15 14:18:01 +02:00
2023-04-26 11:24:05 +02:00
2023-04-26 11:24:05 +02:00
2019-06-05 17:37:05 +02:00
2019-10-24 14:53:49 -07:00
2018-01-24 19:13:45 -05:00
2019-06-05 17:30:29 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2019-12-18 16:09:07 +01:00
2019-08-31 01:08:26 +02:00
2019-06-19 11:23:13 -04:00
2022-03-19 13:40:16 +01:00