syzbot


KASAN: invalid-free in shmem_destroy_callback

Status: closed as invalid on 2018/05/26 17:44
Subsystems: mm
[Documentation on labels]
Reported-by: syzbot+aadcf1130d40ff62031e@syzkaller.appspotmail.com
First crash: 2683d, last: 2683d

Sample crash report:
netlink: 'syz-executor4': attribute type 25 has an invalid length.
netlink: 3 bytes leftover after parsing attributes in process `syz-executor4'.
netlink: 'syz-executor4': attribute type 25 has an invalid length.
netlink: 3 bytes leftover after parsing attributes in process `syz-executor4'.
==================================================================
BUG: KASAN: double-free or invalid-free in shmem_destroy_callback+0xa2/0xc0 mm/shmem.c:3865

CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.16.0+ #10
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <IRQ>
 __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_invalid_free+0x55/0x80 mm/kasan/report.c:336
 __kasan_slab_free+0x150/0x170 mm/kasan/kasan.c:501
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3498 [inline]
 kfree+0xd9/0x260 mm/slab.c:3813
 shmem_destroy_callback+0xa2/0xc0 mm/shmem.c:3865
 __rcu_reclaim kernel/rcu/rcu.h:178 [inline]
 rcu_do_batch kernel/rcu/tree.c:2675 [inline]
 invoke_rcu_callbacks kernel/rcu/tree.c:2930 [inline]
 __rcu_process_callbacks kernel/rcu/tree.c:2897 [inline]
 rcu_process_callbacks+0x941/0x15f0 kernel/rcu/tree.c:2914
 __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:862
 </IRQ>
RIP: 0010:native_safe_halt+0x6/0x10 arch/x86/include/asm/irqflags.h:54
RSP: 0018:ffffffff88c07bc0 EFLAGS: 00000286 ORIG_RAX: ffffffffffffff13
RAX: dffffc0000000000 RBX: 1ffffffff1180f7b RCX: 0000000000000000
RDX: 1ffffffff11a30f0 RSI: 0000000000000001 RDI: ffffffff88d18780
RBP: ffffffff88c07bc0 R08: ffffed003b5c46c3 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: ffffffff88c07c78 R14: ffffffff897ba8e0 R15: 0000000000000000
 arch_safe_halt arch/x86/include/asm/paravirt.h:94 [inline]
 default_idle+0xc2/0x440 arch/x86/kernel/process.c:354
 arch_cpu_idle+0x10/0x20 arch/x86/kernel/process.c:345
 default_idle_call+0x6d/0x90 kernel/sched/idle.c:93
 cpuidle_idle_call kernel/sched/idle.c:153 [inline]
 do_idle+0x395/0x560 kernel/sched/idle.c:262
 cpu_startup_entry+0x104/0x120 kernel/sched/idle.c:368
 rest_init+0xe1/0xe4 init/main.c:441
 start_kernel+0x906/0x92d init/main.c:737
 x86_64_start_reservations+0x29/0x2b arch/x86/kernel/head64.c:443
 x86_64_start_kernel+0x76/0x79 arch/x86/kernel/head64.c:424
 secondary_startup_64+0xa5/0xb0 arch/x86/kernel/head_64.S:242

Allocated by task 4488:
 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
 __do_kmalloc_node mm/slab.c:3682 [inline]
 __kmalloc_node+0x47/0x70 mm/slab.c:3689
 kmalloc_node include/linux/slab.h:554 [inline]
 __vmalloc_area_node mm/vmalloc.c:1686 [inline]
 __vmalloc_node_range+0x1f5/0x720 mm/vmalloc.c:1759
 __vmalloc_node mm/vmalloc.c:1804 [inline]
 __vmalloc_node_flags mm/vmalloc.c:1818 [inline]
 vzalloc+0x45/0x50 mm/vmalloc.c:1857
 alloc_counters.isra.11+0xaf/0x820 net/ipv4/netfilter/ip_tables.c:801
 copy_entries_to_user net/ipv4/netfilter/ip_tables.c:823 [inline]
 get_entries net/ipv4/netfilter/ip_tables.c:1025 [inline]
 do_ipt_get_ctl+0x7e0/0xc00 net/ipv4/netfilter/ip_tables.c:1701
 nf_sockopt net/netfilter/nf_sockopt.c:104 [inline]
 nf_getsockopt+0x80/0xe0 net/netfilter/nf_sockopt.c:122
 ip_getsockopt+0x1a0/0x230 net/ipv4/ip_sockglue.c:1564
 tcp_getsockopt+0x93/0xe0 net/ipv4/tcp.c:3490
 sock_common_getsockopt+0x9a/0xe0 net/core/sock.c:3001
 __sys_getsockopt+0x1a5/0x370 net/socket.c:1940
 SYSC_getsockopt net/socket.c:1951 [inline]
 SyS_getsockopt+0x34/0x50 net/socket.c:1948
 do_syscall_64+0x29e/0x9d0 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 4488:
 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
 kvfree+0x61/0x70 mm/util.c:438
 __vunmap+0x2c5/0x3c0 mm/vmalloc.c:1542
 vfree+0x68/0x100 mm/vmalloc.c:1606
 copy_entries_to_user net/ipv4/netfilter/ip_tables.c:868 [inline]
 get_entries net/ipv4/netfilter/ip_tables.c:1025 [inline]
 do_ipt_get_ctl+0xa1f/0xc00 net/ipv4/netfilter/ip_tables.c:1701
 nf_sockopt net/netfilter/nf_sockopt.c:104 [inline]
 nf_getsockopt+0x80/0xe0 net/netfilter/nf_sockopt.c:122
 ip_getsockopt+0x1a0/0x230 net/ipv4/ip_sockglue.c:1564
 tcp_getsockopt+0x93/0xe0 net/ipv4/tcp.c:3490
 sock_common_getsockopt+0x9a/0xe0 net/core/sock.c:3001
 __sys_getsockopt+0x1a5/0x370 net/socket.c:1940
 SYSC_getsockopt net/socket.c:1951 [inline]
 SyS_getsockopt+0x34/0x50 net/socket.c:1948
 do_syscall_64+0x29e/0x9d0 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff8801d6c26300
 which belongs to the cache kmalloc-32 of size 32
The buggy address is located 0 bytes inside of
 32-byte region [ffff8801d6c26300, ffff8801d6c26320)
The buggy address belongs to the page:
page:ffffea00075b0980 count:1 mapcount:0 mapping:ffff8801d6c26000 index:0xffff8801d6c26fc1
flags: 0x2fffc0000000100(slab)
raw: 02fffc0000000100 ffff8801d6c26000 ffff8801d6c26fc1 000000010000003e
raw: ffffea00075ce960 ffffea0007619520 ffff8801da8001c0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801d6c26200: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
 ffff8801d6c26280: 00 00 00 fc fc fc fc fc fb fb fb fb fc fc fc fc
>ffff8801d6c26300: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
                   ^
 ffff8801d6c26380: fb fb fb fb fc fc fc fc 00 00 03 fc fc fc fc fc
 ffff8801d6c26400: 00 04 fc fc 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/04/21 02:20 net-next-old cf1a1e07fc8b ca03d688 .config console log report ci-upstream-net-kasan-gce
* Struck through repros no longer work on HEAD.