Eric Dumazet
ad4adb10e3
soreuseport: initialise timewait reuseport field
commit 3099a52918937ab86ec47038ad80d377ba16c531 upstream.
syzbot reported an uninit-value in inet_csk_bind_conflict() [1]
It turns out we never propagated sk->sk_reuseport into timewait socket.
[1]
BUG: KMSAN: uninit-value in inet_csk_bind_conflict+0x5f9/0x990 net/ipv4/inet_connection_sock.c:151
CPU: 1 PID: 3589 Comm: syzkaller008242 Not tainted 4.16.0+ #82
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x185/0x1d0 lib/dump_stack.c:53
kmsan_report+0x142/0x240 mm/kmsan/kmsan.c:1067
__msan_warning_32+0x6c/0xb0 mm/kmsan/kmsan_instr.c:676
inet_csk_bind_conflict+0x5f9/0x990 net/ipv4/inet_connection_sock.c:151
inet_csk_get_port+0x1d28/0x1e40 net/ipv4/inet_connection_sock.c:320
inet6_bind+0x121c/0x1820 net/ipv6/af_inet6.c:399
SYSC_bind+0x3f2/0x4b0 net/socket.c:1474
SyS_bind+0x54/0x80 net/socket.c:1460
do_syscall_64+0x309/0x430 arch/x86/entry/common.c:287
entry_SYSCALL_64_after_hwframe+0x3d/0xa2
RIP: 0033:0x4416e9
RSP: 002b:00007ffce6d15c88 EFLAGS: 00000217 ORIG_RAX: 0000000000000031
RAX: ffffffffffffffda RBX: 0100000000000000 RCX: 00000000004416e9
RDX: 000000000000001c RSI: 0000000020402000 RDI: 0000000000000004
RBP: 0000000000000000 R08: 00000000e6d15e08 R09: 00000000e6d15e08
R10: 0000000000000004 R11: 0000000000000217 R12: 0000000000009478
R13: 00000000006cd448 R14: 0000000000000000 R15: 0000000000000000
Uninit was stored to memory at:
kmsan_save_stack_with_flags mm/kmsan/kmsan.c:278 [inline]
kmsan_save_stack mm/kmsan/kmsan.c:293 [inline]
kmsan_internal_chain_origin+0x12b/0x210 mm/kmsan/kmsan.c:684
__msan_chain_origin+0x69/0xc0 mm/kmsan/kmsan_instr.c:521
tcp_time_wait+0xf17/0xf50 net/ipv4/tcp_minisocks.c:283
tcp_rcv_state_process+0xebe/0x6490 net/ipv4/tcp_input.c:6003
tcp_v6_do_rcv+0x11dd/0x1d90 net/ipv6/tcp_ipv6.c:1331
sk_backlog_rcv include/net/sock.h:908 [inline]
__release_sock+0x2d6/0x680 net/core/sock.c:2271
release_sock+0x97/0x2a0 net/core/sock.c:2786
tcp_close+0x277/0x18f0 net/ipv4/tcp.c:2269
inet_release+0x240/0x2a0 net/ipv4/af_inet.c:427
inet6_release+0xaf/0x100 net/ipv6/af_inet6.c:435
sock_release net/socket.c:595 [inline]
sock_close+0xe0/0x300 net/socket.c:1149
__fput+0x49e/0xa10 fs/file_table.c:209
____fput+0x37/0x40 fs/file_table.c:243
task_work_run+0x243/0x2c0 kernel/task_work.c:113
exit_task_work include/linux/task_work.h:22 [inline]
do_exit+0x10e1/0x38d0 kernel/exit.c:867
do_group_exit+0x1a0/0x360 kernel/exit.c:970
SYSC_exit_group+0x21/0x30 kernel/exit.c:981
SyS_exit_group+0x25/0x30 kernel/exit.c:979
do_syscall_64+0x309/0x430 arch/x86/entry/common.c:287
entry_SYSCALL_64_after_hwframe+0x3d/0xa2
Uninit was stored to memory at:
kmsan_save_stack_with_flags mm/kmsan/kmsan.c:278 [inline]
kmsan_save_stack mm/kmsan/kmsan.c:293 [inline]
kmsan_internal_chain_origin+0x12b/0x210 mm/kmsan/kmsan.c:684
__msan_chain_origin+0x69/0xc0 mm/kmsan/kmsan_instr.c:521
inet_twsk_alloc+0xaef/0xc00 net/ipv4/inet_timewait_sock.c:182
tcp_time_wait+0xd9/0xf50 net/ipv4/tcp_minisocks.c:258
tcp_rcv_state_process+0xebe/0x6490 net/ipv4/tcp_input.c:6003
tcp_v6_do_rcv+0x11dd/0x1d90 net/ipv6/tcp_ipv6.c:1331
sk_backlog_rcv include/net/sock.h:908 [inline]
__release_sock+0x2d6/0x680 net/core/sock.c:2271
release_sock+0x97/0x2a0 net/core/sock.c:2786
tcp_close+0x277/0x18f0 net/ipv4/tcp.c:2269
inet_release+0x240/0x2a0 net/ipv4/af_inet.c:427
inet6_release+0xaf/0x100 net/ipv6/af_inet6.c:435
sock_release net/socket.c:595 [inline]
sock_close+0xe0/0x300 net/socket.c:1149
__fput+0x49e/0xa10 fs/file_table.c:209
____fput+0x37/0x40 fs/file_table.c:243
task_work_run+0x243/0x2c0 kernel/task_work.c:113
exit_task_work include/linux/task_work.h:22 [inline]
do_exit+0x10e1/0x38d0 kernel/exit.c:867
do_group_exit+0x1a0/0x360 kernel/exit.c:970
SYSC_exit_group+0x21/0x30 kernel/exit.c:981
SyS_exit_group+0x25/0x30 kernel/exit.c:979
do_syscall_64+0x309/0x430 arch/x86/entry/common.c:287
entry_SYSCALL_64_after_hwframe+0x3d/0xa2
Uninit was created at:
kmsan_save_stack_with_flags mm/kmsan/kmsan.c:278 [inline]
kmsan_internal_poison_shadow+0xb8/0x1b0 mm/kmsan/kmsan.c:188
kmsan_kmalloc+0x94/0x100 mm/kmsan/kmsan.c:314
kmem_cache_alloc+0xaab/0xb90 mm/slub.c:2756
inet_twsk_alloc+0x13b/0xc00 net/ipv4/inet_timewait_sock.c:163
tcp_time_wait+0xd9/0xf50 net/ipv4/tcp_minisocks.c:258
tcp_rcv_state_process+0xebe/0x6490 net/ipv4/tcp_input.c:6003
tcp_v6_do_rcv+0x11dd/0x1d90 net/ipv6/tcp_ipv6.c:1331
sk_backlog_rcv include/net/sock.h:908 [inline]
__release_sock+0x2d6/0x680 net/core/sock.c:2271
release_sock+0x97/0x2a0 net/core/sock.c:2786
tcp_close+0x277/0x18f0 net/ipv4/tcp.c:2269
inet_release+0x240/0x2a0 net/ipv4/af_inet.c:427
inet6_release+0xaf/0x100 net/ipv6/af_inet6.c:435
sock_release net/socket.c:595 [inline]
sock_close+0xe0/0x300 net/socket.c:1149
__fput+0x49e/0xa10 fs/file_table.c:209
____fput+0x37/0x40 fs/file_table.c:243
task_work_run+0x243/0x2c0 kernel/task_work.c:113
exit_task_work include/linux/task_work.h:22 [inline]
do_exit+0x10e1/0x38d0 kernel/exit.c:867
do_group_exit+0x1a0/0x360 kernel/exit.c:970
SYSC_exit_group+0x21/0x30 kernel/exit.c:981
SyS_exit_group+0x25/0x30 kernel/exit.c:979
do_syscall_64+0x309/0x430 arch/x86/entry/common.c:287
entry_SYSCALL_64_after_hwframe+0x3d/0xa2
Fixes: da5e36308d ("soreuseport: TCP/IPv4 implementation")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-16 10:06:50 +02:00
..
2015-04-11 22:28:27 -04:00
2015-11-05 04:04:00 +01:00
2015-02-20 17:35:14 -05:00
2014-12-10 15:33:16 -05:00
2015-09-21 16:03:04 -07:00
2018-02-16 20:09:40 +01:00
2018-02-16 20:09:40 +01:00
2015-10-28 06:44:45 +01:00
2017-10-21 17:09:01 +02:00
2015-09-18 21:59:31 +02:00
2015-10-21 00:49:25 +02:00
2015-08-26 11:01:44 -07:00
2017-05-14 13:32:58 +02:00
2015-09-17 13:20:05 +02:00
2016-09-30 10:18:36 +02:00
2015-11-01 12:14:47 -05:00
2014-09-18 10:54:36 +02:00
2018-01-31 12:06:14 +01:00
2015-06-28 16:55:44 -07:00
2015-11-02 22:52:24 -05:00
2014-11-10 13:27:49 -05:00
2015-07-27 01:05:24 -07:00
2016-04-20 15:42:04 +09:00
2014-01-13 17:39:11 +01:00
2018-04-13 19:50:00 +02:00
2015-09-30 13:16:44 +02:00
2015-08-17 21:33:06 -07:00
2017-02-18 16:39:26 +01:00
2015-07-20 12:41:30 -07:00
2016-05-18 17:06:39 -07:00
2015-04-09 00:02:26 -04:00
2014-02-09 17:32:50 -08:00
2015-03-06 21:50:02 -05:00
2015-09-17 17:18:37 -07:00
2014-02-09 17:32:49 -08:00
2014-02-09 17:32:49 -08:00
2015-11-01 15:56:11 -05:00
2018-02-25 11:03:34 +01:00
2016-03-03 15:07:04 -08:00
2015-10-08 04:27:02 -07:00
2017-06-07 12:05:59 +02:00
2015-09-23 15:33:15 -07:00
2015-09-09 14:19:50 -07:00
2015-09-01 16:46:08 -07:00
2015-10-07 04:27:42 -07:00
2014-02-12 07:02:11 +01:00
2014-11-12 15:01:35 -05:00
2014-09-30 01:02:26 -04:00
2017-12-05 11:22:49 +01:00
2015-08-27 15:42:48 -07:00
2015-08-10 14:03:54 -07:00
2015-08-31 15:17:17 -07:00
2014-11-05 16:30:03 -05:00
2014-02-06 09:34:58 +01:00
2015-09-30 13:16:44 +02:00
2015-03-23 22:12:09 -04:00
2015-10-03 04:32:42 -07:00
2015-03-18 22:00:35 -04:00
2015-11-02 22:46:09 -05:00
2016-03-03 15:07:07 -08:00
2016-01-31 11:29:01 -08:00
2017-09-27 11:00:11 +02:00
2015-10-23 05:42:21 -07:00
2017-11-18 11:11:07 +01:00
2018-05-16 10:06:50 +02:00
2015-12-16 00:14:12 -05:00
2014-08-24 18:09:23 -07:00
2017-09-27 11:00:10 +02:00
2017-07-21 07:44:55 +02:00
2018-02-25 11:03:34 +01:00
2017-06-07 12:05:59 +02:00
2018-02-28 10:17:21 +01:00
2016-05-11 11:21:09 +02:00
2018-01-02 20:33:24 +01:00
2018-01-31 12:06:12 +01:00
2014-11-24 04:28:49 -05:00
2017-08-11 09:08:56 -07:00
2016-01-04 22:58:30 -05:00
2014-10-14 02:18:27 +02:00
2014-12-10 15:21:24 -05:00
2018-04-29 07:50:05 +02:00
2014-12-10 15:21:24 -05:00
2015-10-08 04:27:03 -07:00
2018-05-16 10:06:46 +02:00
2015-10-21 00:49:24 +02:00
2014-09-22 16:23:15 -04:00
2015-10-23 06:26:42 -07:00
2014-11-05 23:52:33 -08:00
2015-12-01 15:07:59 -05:00
2015-08-10 13:46:21 -07:00
2018-01-31 12:06:14 +01:00
2014-08-07 20:55:21 -04:00
2018-02-25 11:03:51 +01:00
2014-02-08 10:36:58 -05:00
2018-05-16 10:06:50 +02:00
2015-09-30 13:16:44 +02:00
2015-03-02 13:06:31 -05:00
2014-10-06 18:02:32 -04:00
2015-08-27 14:18:48 -07:00
2014-05-23 16:28:53 -04:00
2018-02-25 11:03:40 +01:00
2014-12-17 11:49:55 +01:00
2015-10-16 00:52:19 -07:00
2016-01-04 22:58:30 -05:00
2015-10-21 19:15:20 -07:00
2017-08-30 10:19:21 +02:00
2016-03-03 15:07:05 -08:00
2014-06-02 11:00:41 -07:00
2018-04-24 09:32:04 +02:00
2014-10-15 07:48:18 +02:00
2016-11-15 07:46:36 +01:00
2016-06-24 10:18:16 -07:00
2015-03-12 22:58:12 -04:00
2018-03-22 09:23:22 +01:00
2015-07-09 15:12:20 -07:00
2014-01-19 19:53:18 -08:00
2015-10-26 22:24:22 -07:00
2015-08-29 13:07:54 -07:00
2015-03-02 13:06:31 -05:00
2018-03-11 16:19:46 +01:00
2015-12-05 18:15:29 -05:00
2014-09-05 17:35:28 -07:00
2018-04-13 19:50:07 +02:00
2017-07-05 14:37:21 +02:00