Eric Dumazet
7f582b248d
tcp: purge write queue in tcp_connect_init()
...
syzkaller found a reliable way to crash the host, hitting a BUG()
in __tcp_retransmit_skb()
Malicous MSG_FASTOPEN is the root cause. We need to purge write queue
in tcp_connect_init() at the point we init snd_una/write_seq.
This patch also replaces the BUG() by a less intrusive WARN_ON_ONCE()
kernel BUG at net/ipv4/tcp_output.c:2837!
invalid opcode: 0000 [#1 ] SMP KASAN
Dumping ftrace buffer:
(ftrace buffer empty)
Modules linked in:
CPU: 0 PID: 5276 Comm: syz-executor0 Not tainted 4.17.0-rc3+ #51
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:__tcp_retransmit_skb+0x2992/0x2eb0 net/ipv4/tcp_output.c:2837
RSP: 0000:ffff8801dae06ff8 EFLAGS: 00010206
RAX: ffff8801b9fe61c0 RBX: 00000000ffc18a16 RCX: ffffffff864e1a49
RDX: 0000000000000100 RSI: ffffffff864e2e12 RDI: 0000000000000005
RBP: ffff8801dae073a0 R08: ffff8801b9fe61c0 R09: ffffed0039c40dd2
R10: ffffed0039c40dd2 R11: ffff8801ce206e93 R12: 00000000421eeaad
R13: ffff8801ce206d4e R14: ffff8801ce206cc0 R15: ffff8801cd4f4a80
FS: 0000000000000000(0000) GS:ffff8801dae00000(0063) knlGS:00000000096bc900
CS: 0010 DS: 002b ES: 002b CR0: 0000000080050033
CR2: 0000000020000000 CR3: 00000001c47b6000 CR4: 00000000001406f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<IRQ>
tcp_retransmit_skb+0x2e/0x250 net/ipv4/tcp_output.c:2923
tcp_retransmit_timer+0xc50/0x3060 net/ipv4/tcp_timer.c:488
tcp_write_timer_handler+0x339/0x960 net/ipv4/tcp_timer.c:573
tcp_write_timer+0x111/0x1d0 net/ipv4/tcp_timer.c:593
call_timer_fn+0x230/0x940 kernel/time/timer.c:1326
expire_timers kernel/time/timer.c:1363 [inline]
__run_timers+0x79e/0xc50 kernel/time/timer.c:1666
run_timer_softirq+0x4c/0x70 kernel/time/timer.c:1692
__do_softirq+0x2e0/0xaf5 kernel/softirq.c:285
invoke_softirq kernel/softirq.c:365 [inline]
irq_exit+0x1d1/0x200 kernel/softirq.c:405
exiting_irq arch/x86/include/asm/apic.h:525 [inline]
smp_apic_timer_interrupt+0x17e/0x710 arch/x86/kernel/apic/apic.c:1052
apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:863
Fixes: cf60af03ca4e ("net-tcp: Fast Open client - sendmsg(MSG_FASTOPEN)")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Yuchung Cheng <ycheng@google.com>
Cc: Neal Cardwell <ncardwell@google.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-05-16 12:18:00 -04:00
..
2018-05-08 14:15:32 +02:00
2018-03-31 23:33:04 -04:00
2017-11-03 22:11:17 +08:00
2018-04-05 22:05:03 -04:00
2017-10-21 01:33:19 +01:00
2018-03-27 13:18:09 -04:00
2018-02-27 10:46:01 +01:00
2018-02-13 13:59:03 +01:00
2018-03-27 13:18:09 -04:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-02-28 22:44:44 -05:00
2018-04-01 20:57:39 -04:00
2018-03-29 14:10:30 -04:00
2018-03-27 13:18:09 -04:00
2016-06-30 05:03:36 -04:00
2017-10-08 10:12:15 -07:00
2018-03-27 13:18:09 -04:00
2018-03-27 13:18:09 -04:00
2018-02-02 19:49:31 -05:00
2018-03-12 11:03:42 -04:00
2018-03-31 23:25:39 -04:00
2018-02-01 09:48:42 -05:00
2018-04-07 22:32:32 -04:00
2018-04-09 10:57:35 -04:00
2018-03-04 17:49:17 -05:00
2018-04-04 12:04:59 -04:00
2018-04-10 11:03:32 -04:00
2018-03-22 15:12:56 -04:00
2017-11-02 11:10:55 +01:00
2018-04-16 12:57:06 -04:00
2018-03-22 15:12:56 -04:00
2017-06-25 11:42:01 -04:00
2018-04-05 15:16:15 -04:00
2018-03-27 13:18:09 -04:00
2018-03-26 12:07:48 -04:00
2018-03-27 13:18:09 -04:00
2018-03-26 13:14:43 -04:00
2018-03-27 13:18:09 -04:00
2018-03-01 13:13:23 -05:00
2018-03-01 13:13:23 -05:00
2018-01-08 18:11:02 +01:00
2018-05-11 12:00:58 -04:00
2018-03-31 23:25:39 -04:00
2017-03-24 13:17:07 -07:00
2017-08-07 11:39:22 -07:00
2018-03-27 13:18:09 -04:00
2018-05-10 15:40:52 -04:00
2018-03-25 20:53:54 -04:00
2018-03-27 13:18:09 -04:00
2018-05-02 11:12:32 -04:00
2017-08-06 21:25:10 -07:00
2017-10-16 21:24:25 +01:00
2017-11-15 14:09:52 +09:00
2017-08-06 21:25:10 -07:00
2016-12-06 11:34:24 -05:00
2017-12-20 14:00:25 -05:00
2017-12-13 15:51:12 -05:00
2017-08-06 21:25:10 -07:00
2017-08-06 21:25:10 -07:00
2016-11-21 13:20:17 -05:00
2018-02-28 12:03:47 -05:00
2018-04-23 09:51:06 -04:00
2018-03-31 23:33:04 -04:00
2017-05-17 16:06:01 -04:00
2018-03-27 13:18:09 -04:00
2018-03-31 23:37:32 -04:00
2018-01-31 10:26:30 -05:00
2018-01-22 16:01:30 -05:00
2018-05-16 12:18:00 -04:00
2017-12-08 10:07:02 -05:00
2017-12-08 14:14:11 -05:00
2017-08-06 21:25:10 -07:00
2018-03-07 15:01:03 -05:00
2018-02-06 11:39:31 +01:00
2017-09-29 06:07:00 +01:00
2017-11-02 11:10:55 +01:00
2017-08-06 21:25:10 -07:00
2017-08-30 11:20:08 -07:00
2017-08-06 21:25:10 -07:00
2018-05-03 11:28:50 -04:00
2018-02-28 11:43:28 -05:00
2017-08-07 11:39:22 -07:00
2017-11-02 11:10:55 +01:00
2018-01-22 16:01:30 -05:00
2017-07-24 13:52:59 -07:00
2018-05-11 12:00:58 -04:00
2018-03-27 13:18:09 -04:00
2017-12-19 08:23:21 +01:00
2017-06-16 11:48:39 -04:00
2017-04-14 10:07:39 +02:00
2018-03-07 10:54:29 +01:00
2018-03-04 17:49:17 -05:00
2018-03-27 13:18:09 -04:00
2017-02-09 10:22:17 +01:00
2017-11-02 11:10:55 +01:00