Kuniyuki Iwashima
d95456660f
af_unix: Fix data-races around sk->sk_shutdown.
...
[ Upstream commit afe8764f76346ba838d4f162883e23d2fcfaa90e ]
sk->sk_shutdown is changed under unix_state_lock(sk), but
unix_dgram_sendmsg() calls two functions to read sk_shutdown locklessly.
sock_alloc_send_pskb
`- sock_wait_for_wmem
Let's use READ_ONCE() there.
Note that the writer side was marked by commit e1d09c2c2f57 ("af_unix:
Fix data races around sk->sk_shutdown.").
BUG: KCSAN: data-race in sock_alloc_send_pskb / unix_release_sock
write (marked) to 0xffff8880069af12c of 1 bytes by task 1 on cpu 1:
unix_release_sock+0x75c/0x910 net/unix/af_unix.c:631
unix_release+0x59/0x80 net/unix/af_unix.c:1053
__sock_release+0x7d/0x170 net/socket.c:654
sock_close+0x19/0x30 net/socket.c:1386
__fput+0x2a3/0x680 fs/file_table.c:384
____fput+0x15/0x20 fs/file_table.c:412
task_work_run+0x116/0x1a0 kernel/task_work.c:179
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
exit_to_user_mode_loop kernel/entry/common.c:171 [inline]
exit_to_user_mode_prepare+0x174/0x180 kernel/entry/common.c:204
__syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline]
syscall_exit_to_user_mode+0x1a/0x30 kernel/entry/common.c:297
do_syscall_64+0x4b/0x90 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x6e/0xd8
read to 0xffff8880069af12c of 1 bytes by task 28650 on cpu 0:
sock_alloc_send_pskb+0xd2/0x620 net/core/sock.c:2767
unix_dgram_sendmsg+0x2f8/0x14f0 net/unix/af_unix.c:1944
unix_seqpacket_sendmsg net/unix/af_unix.c:2308 [inline]
unix_seqpacket_sendmsg+0xba/0x130 net/unix/af_unix.c:2292
sock_sendmsg_nosec net/socket.c:725 [inline]
sock_sendmsg+0x148/0x160 net/socket.c:748
____sys_sendmsg+0x4e4/0x610 net/socket.c:2494
___sys_sendmsg+0xc6/0x140 net/socket.c:2548
__sys_sendmsg+0x94/0x140 net/socket.c:2577
__do_sys_sendmsg net/socket.c:2586 [inline]
__se_sys_sendmsg net/socket.c:2584 [inline]
__x64_sys_sendmsg+0x45/0x50 net/socket.c:2584
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+0x6e/0xd8
value changed: 0x00 -> 0x03
Reported by Kernel Concurrency Sanitizer on:
CPU: 0 PID: 28650 Comm: systemd-coredum Not tainted 6.4.0-11989-g6843306689af #6
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: syzkaller <syzkaller@googlegroups.com>
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Reviewed-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
..
2023-09-19 12:22:27 +02:00
2022-12-31 13:14:42 +01:00
2023-05-24 17:36:52 +01:00
2023-06-09 10:32:26 +02:00
2022-06-22 14:22:01 +02:00
2023-08-30 16:18:18 +02:00
2023-09-19 12:22:33 +02:00
2022-12-31 13:14:11 +01:00
2023-07-27 08:46:59 +02:00
2023-03-17 08:48:54 +01:00
2023-08-30 16:18:20 +02:00
2023-08-11 15:13:55 +02:00
2023-09-19 12:22:59 +02:00
2023-08-11 15:13:53 +02:00
2023-09-19 12:22:52 +02:00
2023-07-23 13:47:30 +02:00
2023-05-17 11:50:18 +02:00
2023-04-05 11:25:02 +02:00
2022-11-03 23:59:14 +09:00
2023-09-19 12:22:58 +02:00
2023-09-19 12:22:58 +02:00
2023-03-22 13:31:28 +01:00
2022-11-26 09:24:50 +01:00
2023-08-26 14:23:32 +02:00
2023-04-26 13:51:54 +02:00
2022-04-27 14:38:53 +02:00
2023-07-27 08:47:02 +02:00
2023-06-09 10:32:25 +02:00
2022-12-14 11:37:25 +01:00
2023-02-06 07:59:02 +01:00
2023-02-22 12:57:09 +01:00
2023-07-05 18:25:04 +01:00
2023-08-30 16:18:16 +02:00
2023-09-19 12:22:49 +02:00
2023-09-19 12:22:29 +02:00
2023-07-23 13:46:56 +02:00
2023-09-19 12:22:35 +02:00
2023-07-23 13:46:56 +02:00
2023-05-24 17:36:51 +01:00
2023-02-22 12:57:09 +01:00
2023-08-16 18:22:01 +02:00
2022-01-11 15:35:16 +01:00
2023-04-20 12:13:53 +02:00
2023-03-10 09:39:16 +01:00
2022-04-08 14:23:00 +02:00
2023-02-22 12:57:02 +01:00
2023-05-17 11:50:17 +02:00
2023-09-19 12:22:58 +02:00
2023-09-19 12:22:58 +02:00
2023-06-14 11:13:01 +02:00
2021-11-18 19:17:11 +01:00
2023-08-30 16:18:10 +02:00
2023-08-03 10:22:37 +02:00
2023-08-26 14:23:22 +02:00
2023-09-19 12:22:59 +02:00
2023-05-24 17:36:49 +01:00
2023-09-19 12:22:34 +02:00
2023-02-09 11:26:40 +01:00
2023-09-19 12:22:58 +02:00
2023-08-26 14:23:33 +02:00
2023-06-21 15:59:15 +02:00
2023-06-21 15:59:15 +02:00
2023-09-19 12:22:30 +02:00