KASAN: use-after-free Read in tipc_sub_unsubscribe (2)

2018-04-11 Thread syzbot

Hello,

syzbot hit the following crash on upstream commit
b284d4d5a6785f8cd07eda2646a95782373cd01e (Tue Apr 10 19:25:30 2018 +)
Merge tag 'ceph-for-4.17-rc1' of git://github.com/ceph/ceph-client
syzbot dashboard link:  
https://syzkaller.appspot.com/bug?extid=aa245f26d42b8305d157


So far this crash happened 2 times on upstream.
C reproducer: https://syzkaller.appspot.com/x/repro.c?id=5881855630901248
syzkaller reproducer:  
https://syzkaller.appspot.com/x/repro.syz?id=5979790213382144
Raw console output:  
https://syzkaller.appspot.com/x/log.txt?id=5808961445953536
Kernel config:  
https://syzkaller.appspot.com/x/.config?id=-1223000601505858474

compiler: gcc (GCC) 8.0.1 20180301 (experimental)

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+aa245f26d42b8305d...@syzkaller.appspotmail.com
It will help syzbot understand when the bug is fixed. See footer for  
details.

If you forward the report, please keep this part and the footer.

R10: 20b89fe4 R11: 0246 R12: 0005
R13:  R14:  R15: 
Service creation failed, no memory
Failed to subscribe for {1906,0,4294967295}
==
BUG: KASAN: use-after-free in tipc_sub_unsubscribe+0x22d/0x305  
net/tipc/subscr.c:167

Read of size 4 at addr 8801b78718d8 by task syzkaller446011/4466

CPU: 1 PID: 4466 Comm: syzkaller446011 Not tainted 4.16.0+ #19
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011

Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1b9/0x294 lib/dump_stack.c:113
 print_address_description+0x6c/0x20b mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report.cold.7+0xac/0x2f5 mm/kasan/report.c:412
 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report.c:432
 tipc_sub_unsubscribe+0x22d/0x305 net/tipc/subscr.c:167
 tipc_conn_delete_sub+0x32d/0x530 net/tipc/topsrv.c:245
 tipc_topsrv_kern_unsubscr+0x280/0x3f0 net/tipc/topsrv.c:598
 tipc_group_delete+0x2dd/0x3f0 net/tipc/group.c:231
 tipc_sk_leave+0x10e/0x210 net/tipc/socket.c:2800
 tipc_release+0x146/0x1290 net/tipc/socket.c:576
 sock_release+0x96/0x1b0 net/socket.c:594
 sock_close+0x16/0x20 net/socket.c:1149
 __fput+0x34d/0x890 fs/file_table.c:209
 fput+0x15/0x20 fs/file_table.c:243
 task_work_run+0x1e4/0x290 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0x1aee/0x2730 kernel/exit.c:865
 do_group_exit+0x16f/0x430 kernel/exit.c:968
 SYSC_exit_group kernel/exit.c:979 [inline]
 SyS_exit_group+0x1d/0x20 kernel/exit.c:977
 do_syscall_64+0x29e/0x9d0 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x43f1f8
RSP: 002b:7fff7867bac8 EFLAGS: 0246 ORIG_RAX: 00e7
RAX: ffda RBX:  RCX: 0043f1f8
RDX:  RSI: 003c RDI: 
RBP: 004bf2e8 R08: 00e7 R09: ffd0
R10: 20b89fe4 R11: 0246 R12: 0001
R13: 006d1180 R14:  R15: 

Allocated by task 4466:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc+0xc4/0xe0 mm/kasan/kasan.c:553
 kmem_cache_alloc_trace+0x152/0x780 mm/slab.c:3620
 kmalloc include/linux/slab.h:512 [inline]
 tipc_sub_subscribe+0x25a/0x6b0 net/tipc/subscr.c:143
 tipc_conn_rcv_sub.isra.5+0x42c/0x7e0 net/tipc/topsrv.c:381
 tipc_topsrv_kern_subscr+0x72b/0xad0 net/tipc/topsrv.c:582
 tipc_group_create+0x72e/0xa50 net/tipc/group.c:194
 tipc_sk_join net/tipc/socket.c:2766 [inline]
 tipc_setsockopt+0x2c9/0xd70 net/tipc/socket.c:2881
 __sys_setsockopt+0x1bd/0x390 net/socket.c:1903
 SYSC_setsockopt net/socket.c:1914 [inline]
 SyS_setsockopt+0x34/0x50 net/socket.c:1911
 do_syscall_64+0x29e/0x9d0 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 4466:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0x11a/0x170 mm/kasan/kasan.c:521
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3498 [inline]
 kfree+0xd9/0x260 mm/slab.c:3813
 tipc_sub_kref_release net/tipc/subscr.c:117 [inline]
 kref_put include/linux/kref.h:70 [inline]
 tipc_sub_put+0x33/0x40 net/tipc/subscr.c:122
 tipc_nametbl_unsubscribe+0x52c/0xaf0 net/tipc/name_table.c:709
 tipc_sub_unsubscribe+0x6d/0x305 net/tipc/subscr.c:166
 tipc_conn_delete_sub+0x32d/0x530 net/tipc/topsrv.c:245
 tipc_topsrv_kern_unsubscr+0x280/0x3f0 net/tipc/topsrv.c:598
 tipc_group_delete+0x2dd/0x3f0 net/tipc/group.c:231
 tipc_sk_leave+0x10e/0x210 net/tipc/socket.c:2800
 tipc_release+0x146/0x1290 net/tipc/socket.c:576
 sock_release+0x96/0x1b0 net/socket.c:594
 sock_close+0x16/0x20 net/socket.c:1149
 __fput+0x34d/0x890 fs/file_table.c:209
 fput+0x15/0x20 fs/file_table.c:243
 task_work_run+0x1e4/0x290 

KASAN: use-after-free Read in tipc_sub_unsubscribe (2)

2018-04-11 Thread syzbot

Hello,

syzbot hit the following crash on upstream commit
b284d4d5a6785f8cd07eda2646a95782373cd01e (Tue Apr 10 19:25:30 2018 +)
Merge tag 'ceph-for-4.17-rc1' of git://github.com/ceph/ceph-client
syzbot dashboard link:  
https://syzkaller.appspot.com/bug?extid=aa245f26d42b8305d157


So far this crash happened 2 times on upstream.
C reproducer: https://syzkaller.appspot.com/x/repro.c?id=5881855630901248
syzkaller reproducer:  
https://syzkaller.appspot.com/x/repro.syz?id=5979790213382144
Raw console output:  
https://syzkaller.appspot.com/x/log.txt?id=5808961445953536
Kernel config:  
https://syzkaller.appspot.com/x/.config?id=-1223000601505858474

compiler: gcc (GCC) 8.0.1 20180301 (experimental)

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+aa245f26d42b8305d...@syzkaller.appspotmail.com
It will help syzbot understand when the bug is fixed. See footer for  
details.

If you forward the report, please keep this part and the footer.

R10: 20b89fe4 R11: 0246 R12: 0005
R13:  R14:  R15: 
Service creation failed, no memory
Failed to subscribe for {1906,0,4294967295}
==
BUG: KASAN: use-after-free in tipc_sub_unsubscribe+0x22d/0x305  
net/tipc/subscr.c:167

Read of size 4 at addr 8801b78718d8 by task syzkaller446011/4466

CPU: 1 PID: 4466 Comm: syzkaller446011 Not tainted 4.16.0+ #19
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011

Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1b9/0x294 lib/dump_stack.c:113
 print_address_description+0x6c/0x20b mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report.cold.7+0xac/0x2f5 mm/kasan/report.c:412
 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report.c:432
 tipc_sub_unsubscribe+0x22d/0x305 net/tipc/subscr.c:167
 tipc_conn_delete_sub+0x32d/0x530 net/tipc/topsrv.c:245
 tipc_topsrv_kern_unsubscr+0x280/0x3f0 net/tipc/topsrv.c:598
 tipc_group_delete+0x2dd/0x3f0 net/tipc/group.c:231
 tipc_sk_leave+0x10e/0x210 net/tipc/socket.c:2800
 tipc_release+0x146/0x1290 net/tipc/socket.c:576
 sock_release+0x96/0x1b0 net/socket.c:594
 sock_close+0x16/0x20 net/socket.c:1149
 __fput+0x34d/0x890 fs/file_table.c:209
 fput+0x15/0x20 fs/file_table.c:243
 task_work_run+0x1e4/0x290 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0x1aee/0x2730 kernel/exit.c:865
 do_group_exit+0x16f/0x430 kernel/exit.c:968
 SYSC_exit_group kernel/exit.c:979 [inline]
 SyS_exit_group+0x1d/0x20 kernel/exit.c:977
 do_syscall_64+0x29e/0x9d0 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x43f1f8
RSP: 002b:7fff7867bac8 EFLAGS: 0246 ORIG_RAX: 00e7
RAX: ffda RBX:  RCX: 0043f1f8
RDX:  RSI: 003c RDI: 
RBP: 004bf2e8 R08: 00e7 R09: ffd0
R10: 20b89fe4 R11: 0246 R12: 0001
R13: 006d1180 R14:  R15: 

Allocated by task 4466:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc+0xc4/0xe0 mm/kasan/kasan.c:553
 kmem_cache_alloc_trace+0x152/0x780 mm/slab.c:3620
 kmalloc include/linux/slab.h:512 [inline]
 tipc_sub_subscribe+0x25a/0x6b0 net/tipc/subscr.c:143
 tipc_conn_rcv_sub.isra.5+0x42c/0x7e0 net/tipc/topsrv.c:381
 tipc_topsrv_kern_subscr+0x72b/0xad0 net/tipc/topsrv.c:582
 tipc_group_create+0x72e/0xa50 net/tipc/group.c:194
 tipc_sk_join net/tipc/socket.c:2766 [inline]
 tipc_setsockopt+0x2c9/0xd70 net/tipc/socket.c:2881
 __sys_setsockopt+0x1bd/0x390 net/socket.c:1903
 SYSC_setsockopt net/socket.c:1914 [inline]
 SyS_setsockopt+0x34/0x50 net/socket.c:1911
 do_syscall_64+0x29e/0x9d0 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 4466:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0x11a/0x170 mm/kasan/kasan.c:521
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3498 [inline]
 kfree+0xd9/0x260 mm/slab.c:3813
 tipc_sub_kref_release net/tipc/subscr.c:117 [inline]
 kref_put include/linux/kref.h:70 [inline]
 tipc_sub_put+0x33/0x40 net/tipc/subscr.c:122
 tipc_nametbl_unsubscribe+0x52c/0xaf0 net/tipc/name_table.c:709
 tipc_sub_unsubscribe+0x6d/0x305 net/tipc/subscr.c:166
 tipc_conn_delete_sub+0x32d/0x530 net/tipc/topsrv.c:245
 tipc_topsrv_kern_unsubscr+0x280/0x3f0 net/tipc/topsrv.c:598
 tipc_group_delete+0x2dd/0x3f0 net/tipc/group.c:231
 tipc_sk_leave+0x10e/0x210 net/tipc/socket.c:2800
 tipc_release+0x146/0x1290 net/tipc/socket.c:576
 sock_release+0x96/0x1b0 net/socket.c:594
 sock_close+0x16/0x20 net/socket.c:1149
 __fput+0x34d/0x890 fs/file_table.c:209
 fput+0x15/0x20 fs/file_table.c:243
 task_work_run+0x1e4/0x290