syzbot


KASAN: invalid-free in sctp_endpoint_put

Status: closed as invalid on 2018/04/10 15:16
Subsystems: sctp
[Documentation on labels]
Reported-by: syzbot+5ed95054538957293521@syzkaller.appspotmail.com
First crash: 2706d, last: 2706d

Sample crash report:
IPVS: set_ctl: invalid protocol: 59 224.0.0.2:20000 lc
==================================================================
BUG: KASAN: double-free or invalid-free in sctp_endpoint_destroy net/sctp/endpointola.c:254 [inline]
BUG: KASAN: double-free or invalid-free in sctp_endpoint_put+0x93/0x280 net/sctp/endpointola.c:297

CPU: 0 PID: 12563 Comm: syz-executor7 Not tainted 4.16.0-rc7+ #373
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+0x194/0x24d lib/dump_stack.c:53
 print_address_description+0x73/0x250 mm/kasan/report.c:256
 kasan_report_invalid_free+0x55/0x80 mm/kasan/report.c:336
 __kasan_slab_free+0x145/0x170 mm/kasan/kasan.c:500
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:527
 __cache_free mm/slab.c:3486 [inline]
 kfree+0xd9/0x260 mm/slab.c:3801
 sctp_endpoint_destroy net/sctp/endpointola.c:254 [inline]
 sctp_endpoint_put+0x93/0x280 net/sctp/endpointola.c:297
 sctp_endpoint_free+0x71/0x90 net/sctp/endpointola.c:240
 sctp_destroy_sock+0xda/0x520 net/sctp/socket.c:4591
 sk_common_release+0x6b/0x2f0 net/core/sock.c:2996
 sctp_close+0x464/0x9a0 net/sctp/socket.c:1563
 inet_release+0xed/0x1c0 net/ipv4/af_inet.c:427
 sock_release+0x8d/0x1e0 net/socket.c:595
 sock_close+0x16/0x20 net/socket.c:1149
 __fput+0x327/0x7e0 fs/file_table.c:209
 ____fput+0x15/0x20 fs/file_table.c:243
 task_work_run+0x199/0x270 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0x9bb/0x1ad0 kernel/exit.c:865
 do_group_exit+0x149/0x400 kernel/exit.c:968
 get_signal+0x73a/0x16d0 kernel/signal.c:2469
 do_signal+0x90/0x1e90 arch/x86/kernel/signal.c:809
 exit_to_usermode_loop+0x258/0x2f0 arch/x86/entry/common.c:162
 prepare_exit_to_usermode arch/x86/entry/common.c:196 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:265 [inline]
 do_syscall_64+0x6ec/0x940 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x454e79
RSP: 002b:00007f2521de0ce8 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca
RAX: fffffffffffffe00 RBX: 000000000072bf80 RCX: 0000000000454e79
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 000000000072bf80
RBP: 000000000072bf80 R08: 0000000000000000 R09: 000000000072bf58
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000a3e81f R14: 00007f2521de19c0 R15: 0000000000000001

Allocated by task 12563:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:552
 kmem_cache_alloc_trace+0x136/0x740 mm/slab.c:3608
 kmalloc include/linux/slab.h:512 [inline]
 kzalloc include/linux/slab.h:701 [inline]
 sctp_endpoint_init net/sctp/endpointola.c:66 [inline]
 sctp_endpoint_new+0x154/0xee0 net/sctp/endpointola.c:195
 sctp_init_sock+0xc48/0x13b0 net/sctp/socket.c:4538
 inet_create+0x953/0xf50 net/ipv4/af_inet.c:378
 __sock_create+0x4d4/0x850 net/socket.c:1285
 sock_create net/socket.c:1325 [inline]
 SYSC_socket net/socket.c:1355 [inline]
 SyS_socket+0xeb/0x1d0 net/socket.c:1335
 do_syscall_64+0x281/0x940 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 12544:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 __kasan_slab_free+0x11a/0x170 mm/kasan/kasan.c:520
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:527
 __cache_free mm/slab.c:3486 [inline]
 kfree+0xd9/0x260 mm/slab.c:3801
 sctp_endpoint_destroy net/sctp/endpointola.c:254 [inline]
 sctp_endpoint_put+0x93/0x280 net/sctp/endpointola.c:297
 sctp_endpoint_free+0x71/0x90 net/sctp/endpointola.c:240
 sctp_destroy_sock+0xda/0x520 net/sctp/socket.c:4591
 sctp_v6_destroy_sock+0x15/0x20 net/sctp/socket.c:8573
 sk_common_release+0x6b/0x2f0 net/core/sock.c:2996
 sctp_close+0x464/0x9a0 net/sctp/socket.c:1563
 inet_release+0xed/0x1c0 net/ipv4/af_inet.c:427
 inet6_release+0x50/0x70 net/ipv6/af_inet6.c:435
 sock_release+0x8d/0x1e0 net/socket.c:595
 sock_close+0x16/0x20 net/socket.c:1149
 __fput+0x327/0x7e0 fs/file_table.c:209
 ____fput+0x15/0x20 fs/file_table.c:243
 task_work_run+0x199/0x270 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0x9bb/0x1ad0 kernel/exit.c:865
 do_group_exit+0x149/0x400 kernel/exit.c:968
 get_signal+0x73a/0x16d0 kernel/signal.c:2469
 do_signal+0x90/0x1e90 arch/x86/kernel/signal.c:809
 exit_to_usermode_loop+0x258/0x2f0 arch/x86/entry/common.c:162
 prepare_exit_to_usermode arch/x86/entry/common.c:196 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:265 [inline]
 do_syscall_64+0x6ec/0x940 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff8801d32b91c0
 which belongs to the cache kmalloc-32 of size 32
The buggy address is located 0 bytes inside of
 32-byte region [ffff8801d32b91c0, ffff8801d32b91e0)
The buggy address belongs to the page:
page:ffffea00074cae40 count:1 mapcount:0 mapping:ffff8801d32b9000 index:0xffff8801d32b9fc1
flags: 0x2fffc0000000100(slab)
raw: 02fffc0000000100 ffff8801d32b9000 ffff8801d32b9fc1 0000000100000031
raw: ffffea00071c49e0 ffffea00075e43e0 ffff8801dac001c0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801d32b9080: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
 ffff8801d32b9100: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
>ffff8801d32b9180: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
                                           ^
 ffff8801d32b9200: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
 ffff8801d32b9280: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/03/31 09:40 upstream b5dbc28762fd 8fbce0e4 .config console log report ci-upstream-kasan-gce
* Struck through repros no longer work on HEAD.