Leon Romanovsky
e82496fbe3
RDMA/ucma: Don't allow join attempts for unsupported AF family
commit 0c81ffc60d upstream.
Users can provide garbage while calling to ucma_join_ip_multicast(),
it will indirectly cause to rdma_addr_size() return 0, making the
call to ucma_process_join(), which had the right checks, but it is
better to check the input as early as possible.
The following crash from syzkaller revealed it.
kernel BUG at lib/string.c:1052!
invalid opcode: 0000 [#1] SMP KASAN Dumping ftrace buffer:
(ftrace buffer empty)
Modules linked in:
CPU: 0 PID: 4113 Comm: syz-executor0 Not tainted 4.16.0-rc5+ #261
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:fortify_panic+0x13/0x20 lib/string.c:1051
RSP: 0018:ffff8801ca81f8f0 EFLAGS: 00010286
RAX: 0000000000000022 RBX: 1ffff10039503f23 RCX: 0000000000000000
RDX: 0000000000000022 RSI: 1ffff10039503ed3 RDI: ffffed0039503f12
RBP: ffff8801ca81f8f0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000006 R11: 0000000000000000 R12: ffff8801ca81f998
R13: ffff8801ca81f938 R14: ffff8801ca81fa58 R15: 000000000000fa00
FS: 0000000000000000(0000) GS:ffff8801db200000(0063) knlGS:000000000a12a900
CS: 0010 DS: 002b ES: 002b CR0: 0000000080050033
CR2: 0000000008138024 CR3: 00000001cbb58004 CR4: 00000000001606f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
memcpy include/linux/string.h:344 [inline]
ucma_join_ip_multicast+0x36b/0x3b0 drivers/infiniband/core/ucma.c:1421
ucma_write+0x2d6/0x3d0 drivers/infiniband/core/ucma.c:1633
__vfs_write+0xef/0x970 fs/read_write.c:480
vfs_write+0x189/0x510 fs/read_write.c:544
SYSC_write fs/read_write.c:589 [inline]
SyS_write+0xef/0x220 fs/read_write.c:581
do_syscall_32_irqs_on arch/x86/entry/common.c:330 [inline]
do_fast_syscall_32+0x3ec/0xf9f arch/x86/entry/common.c:392
entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139
RIP: 0023:0xf7f9ec99
RSP: 002b:00000000ff8172cc EFLAGS: 00000282 ORIG_RAX: 0000000000000004
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000020000100
RDX: 0000000000000063 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
Code: 08 5b 41 5c 41 5d 41 5e 41 5f 5d c3 0f 0b 48 89 df e8 42 2c e3 fb eb de
55 48 89 fe 48 c7 c7 80 75 98 86 48 89 e5 e8 85 95 94 fb <0f> 0b 90 90 90 90
90 90 90 90 90 90 90 55 48 89 e5 41 57 41 56
RIP: fortify_panic+0x13/0x20 lib/string.c:1051 RSP: ffff8801ca81f8f0
Fixes: 5bc2b7b397 ("RDMA/ucma: Allow user space to specify AF_IB when joining multicast")
Reported-by: <syzbot+2287ac532caa81900a4e@syzkaller.appspotmail.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Reviewed-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-24 11:01:29 +01:00
..
2017-11-02 11:10:55 +01:00
2018-03-08 22:41:26 -08:00
2017-11-02 11:10:55 +01:00
2018-02-25 11:07:52 +01:00
2018-02-16 20:22:59 +01:00
2017-12-14 09:53:13 +01:00
2018-02-07 11:12:20 -08:00
2018-03-19 08:42:47 +01:00
2017-11-02 11:10:55 +01:00
2018-03-15 10:54:32 +01:00
2018-03-24 11:01:21 +01:00
2018-01-10 09:31:19 +01:00
2017-11-02 11:10:55 +01:00
2018-03-24 11:01:24 +01:00
2018-03-24 11:01:29 +01:00
2018-02-16 20:23:09 +01:00
2018-03-24 11:01:21 +01:00
2017-12-25 14:26:30 +01:00
2018-03-24 11:01:28 +01:00
2017-12-20 10:10:34 +01:00
2018-02-22 15:42:16 +01:00
2017-11-02 11:10:55 +01:00
2018-03-24 11:01:28 +01:00
2018-03-19 08:42:47 +01:00
2018-03-08 22:41:20 -08:00
2017-11-02 11:10:55 +01:00
2018-02-28 10:19:39 +01:00
2017-11-02 11:10:55 +01:00
2018-02-16 20:22:56 +01:00
2017-11-02 11:10:55 +01:00
2018-02-07 11:12:26 -08:00
2017-08-28 17:15:16 +02:00
2018-02-25 11:07:56 +01:00
2018-03-24 11:01:25 +01:00
2018-03-19 08:42:47 +01:00
2017-11-02 11:10:55 +01:00
2017-12-25 14:26:20 +01:00
2018-02-22 15:42:24 +01:00
2017-11-02 11:10:55 +01:00
2018-03-24 11:01:26 +01:00
2018-02-28 10:19:39 +01:00
2017-12-17 15:08:00 +01:00
2017-11-04 15:01:50 +01:00
2018-03-19 08:42:51 +01:00
2018-03-24 11:01:29 +01:00
2018-03-15 10:54:32 +01:00
2018-03-24 11:01:26 +01:00
2018-03-21 12:06:44 +01:00
2017-11-02 11:10:55 +01:00
2018-03-19 08:42:50 +01:00
2017-12-20 10:10:38 +01:00
2017-11-02 11:10:55 +01:00
2017-12-14 09:53:12 +01:00
2017-11-02 11:10:55 +01:00
2018-03-19 08:42:54 +01:00
2018-03-24 11:01:26 +01: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
2017-12-29 17:53:46 +01:00
2018-02-25 11:08:04 +01:00
2018-03-24 11:01:25 +01:00
2018-03-19 08:42:50 +01:00
2018-01-17 09:45:27 +01:00
2018-03-24 11:01:24 +01:00
2017-11-02 11:10:55 +01:00
2017-08-01 13:31:44 -04:00
2017-11-02 11:10:55 +01:00
2017-12-29 17:53:49 +01:00
2018-03-08 22:41:26 -08:00
2017-11-02 11:10:55 +01:00
2018-03-03 10:24:37 +01:00
2017-11-02 11:10:55 +01:00
2017-12-29 17:53:47 +01:00
2017-11-02 11:10:55 +01:00
2018-03-24 11:01:26 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-03-03 10:24:22 +01:00
2018-03-24 11:01:26 +01:00
2018-03-24 11:01:23 +01:00
2017-11-02 11:10:55 +01:00
2018-03-19 08:42:50 +01:00
2017-09-08 18:26:51 -07:00
2017-11-02 11:10:55 +01:00
2018-03-19 08:42:51 +01:00
2017-12-14 09:53:08 +01:00
2017-11-02 11:10:55 +01:00
2018-03-15 10:54:28 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-12-20 10:10:29 +01:00
2018-03-24 11:01:24 +01:00
2018-03-08 22:41:20 -08:00
2017-11-02 11:10:55 +01:00
2018-03-24 11:01:28 +01:00
2017-07-20 11:37:58 +02:00
2017-11-02 11:10:55 +01:00
2018-03-24 11:01:27 +01:00
2018-03-24 11:01:22 +01:00
2017-08-28 13:52:22 +02:00
2017-11-02 11:10:55 +01:00
2018-03-24 11:01:21 +01:00
2018-02-22 15:42:29 +01:00
2017-12-25 14:26:24 +01:00
2017-12-25 14:26:31 +01:00
2017-12-20 10:10:24 +01:00
2018-03-24 11:01:29 +01:00
2017-11-02 11:10:55 +01:00
2018-03-21 12:06:45 +01:00
2017-11-02 11:10:55 +01:00
2018-03-08 22:41:06 -08:00
2018-02-25 11:07:45 +01:00
2018-03-24 11:01:25 +01:00
2017-08-29 08:52:51 -05:00
2018-03-15 10:54:32 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-03-24 11:01:23 +01:00
2018-03-03 10:24:37 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-02-25 11:07:53 +01:00