syzbot


KASAN: invalid-free in inotify_free_event

Status: closed as invalid on 2018/04/10 15:13
Subsystems: fs
[Documentation on labels]
Reported-by: syzbot+f3a15b65f981711f97a2@syzkaller.appspotmail.com
First crash: 2751d, last: 2751d

Sample crash report:
==================================================================
BUG: KASAN: double-free or invalid-free in inotify_free_event+0x15/0x20 fs/notify/inotify/inotify_fsnotify.c:176

CPU: 1 PID: 18655 Comm: syz-executor2 Not tainted 4.16.0-rc7+ #280
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
 inotify_free_event+0x15/0x20 fs/notify/inotify/inotify_fsnotify.c:176
 fsnotify_destroy_group+0x200/0x3f0 fs/notify/group.c:100
 inotify_release+0x37/0x50 fs/notify/inotify/inotify_user.c:280
 __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_32_irqs_on arch/x86/entry/common.c:336 [inline]
 do_fast_syscall_32+0xbe6/0xf9f arch/x86/entry/common.c:392
 entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139
RIP: 0023:0xf7faec99
RSP: 002b:00000000f778910c EFLAGS: 00000296 ORIG_RAX: 00000000000000f0
RAX: fffffffffffffe00 RBX: 000000000813af98 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000001
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 4491:
 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_node_trace+0x150/0x760 mm/slab.c:3651
 kmalloc_node include/linux/slab.h:550 [inline]
 kzalloc_node include/linux/slab.h:712 [inline]
 __get_vm_area_node+0xae/0x340 mm/vmalloc.c:1402
 __vmalloc_node_range+0xa3/0x650 mm/vmalloc.c:1754
 __vmalloc_node mm/vmalloc.c:1804 [inline]
 __vmalloc_node_flags mm/vmalloc.c:1818 [inline]
 vmalloc+0x45/0x50 mm/vmalloc.c:1840
 xt_compat_add_offset+0x228/0x380 net/netfilter/x_tables.c:559
 compat_calc_entry net/ipv4/netfilter/ip_tables.c:919 [inline]
 compat_table_info+0x22d/0x470 net/ipv4/netfilter/ip_tables.c:950
 compat_get_entries net/ipv4/netfilter/ip_tables.c:1629 [inline]
 compat_do_ipt_get_ctl+0x328/0xc00 net/ipv4/netfilter/ip_tables.c:1661
 compat_nf_sockopt net/netfilter/nf_sockopt.c:139 [inline]
 compat_nf_getsockopt+0x8b/0x130 net/netfilter/nf_sockopt.c:163
 compat_ip_getsockopt+0x18a/0x230 net/ipv4/ip_sockglue.c:1604
 inet_csk_compat_getsockopt+0x95/0x120 net/ipv4/inet_connection_sock.c:1028
 compat_tcp_getsockopt+0x3d/0x70 net/ipv4/tcp.c:3370
 compat_sock_common_getsockopt+0xb2/0x140 net/core/sock.c:2945
 C_SYSC_getsockopt net/compat.c:523 [inline]
 compat_SyS_getsockopt net/compat.c:506 [inline]
 C_SYSC_socketcall net/compat.c:857 [inline]
 compat_SyS_socketcall+0xe74/0x17c0 net/compat.c:788
 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

Freed by task 4491:
 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
 __vunmap+0x2b9/0x380 mm/vmalloc.c:1545
 vfree+0x50/0xe0 mm/vmalloc.c:1606
 xt_compat_flush_offsets+0x68/0x130 net/netfilter/x_tables.c:580
 compat_get_entries net/ipv4/netfilter/ip_tables.c:1636 [inline]
 compat_do_ipt_get_ctl+0x3a2/0xc00 net/ipv4/netfilter/ip_tables.c:1661
 compat_nf_sockopt net/netfilter/nf_sockopt.c:139 [inline]
 compat_nf_getsockopt+0x8b/0x130 net/netfilter/nf_sockopt.c:163
 compat_ip_getsockopt+0x18a/0x230 net/ipv4/ip_sockglue.c:1604
 inet_csk_compat_getsockopt+0x95/0x120 net/ipv4/inet_connection_sock.c:1028
 compat_tcp_getsockopt+0x3d/0x70 net/ipv4/tcp.c:3370
 compat_sock_common_getsockopt+0xb2/0x140 net/core/sock.c:2945
 C_SYSC_getsockopt net/compat.c:523 [inline]
 compat_SyS_getsockopt net/compat.c:506 [inline]
 C_SYSC_socketcall net/compat.c:857 [inline]
 compat_SyS_socketcall+0xe74/0x17c0 net/compat.c:788
 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

The buggy address belongs to the object at ffff8801b2f95e00
 which belongs to the cache kmalloc-64 of size 64
The buggy address is located 0 bytes inside of
 64-byte region [ffff8801b2f95e00, ffff8801b2f95e40)
The buggy address belongs to the page:
page:ffffea0006cbe540 count:1 mapcount:0 mapping:ffff8801b2f95000 index:0x0
flags: 0x2fffc0000000100(slab)
raw: 02fffc0000000100 ffff8801b2f95000 0000000000000000 0000000100000020
raw: ffffea000651f9a0 ffffea00074331a0 ffff8801dac00340 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801b2f95d00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8801b2f95d80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff8801b2f95e00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
                   ^
 ffff8801b2f95e80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8801b2f95f00: fb fb fb fb fb fb fb fb fc fc fc fc 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/30 00:16 upstream 0b412605ef5f d47f0ed6 .config console log report ci-upstream-kasan-gce-386
* Struck through repros no longer work on HEAD.