syzbot


KASAN: use-after-free Read in dev_map_notification

Status: closed as invalid on 2017/10/30 19:25
Reported-by: syzbot+f7a5ab3d5b64715064da838da38e54a48a216632@syzkaller.appspotmail.com
First crash: 3059d, last: 3052d

Sample crash report:
Use struct sctp_assoc_value instead
==================================================================
BUG: KASAN: use-after-free in dev_map_notification+0x522/0x5e0 kernel/bpf/devmap.c:402
Read of size 8 at addr ffff8801d41f7d00 by task syz-executor4/6820

CPU: 0 PID: 6820 Comm: syz-executor4 Not tainted 4.13.0-rc5-next-20170817+ #5
sctp: [Deprecated]: syz-executor1 (pid 6840) Use of int in maxseg socket option.
Use struct sctp_assoc_value instead
sctp: [Deprecated]: syz-executor1 (pid 6840) Use of int in maxseg socket option.
Use struct sctp_assoc_value instead
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:16 [inline]
 dump_stack+0x194/0x257 lib/dump_stack.c:52
 print_address_description+0x73/0x250 mm/kasan/report.c:252
 kasan_report_error mm/kasan/report.c:351 [inline]
 kasan_report+0x24e/0x340 mm/kasan/report.c:409
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430
 dev_map_notification+0x522/0x5e0 kernel/bpf/devmap.c:402
 notifier_call_chain+0x136/0x2c0 kernel/notifier.c:93
 __raw_notifier_call_chain kernel/notifier.c:394 [inline]
 raw_notifier_call_chain+0x2d/0x40 kernel/notifier.c:401
 call_netdevice_notifiers_info+0x51/0x90 net/core/dev.c:1671
 call_netdevice_notifiers net/core/dev.c:1687 [inline]
 rollback_registered_many+0x91c/0xe80 net/core/dev.c:7141
 rollback_registered+0x1be/0x3c0 net/core/dev.c:7183
 unregister_netdevice_queue+0x2e3/0x5d0 net/core/dev.c:8171
 unregister_netdevice include/linux/netdevice.h:2429 [inline]
 __tun_detach+0x1020/0x1390 drivers/net/tun.c:576
 tun_detach drivers/net/tun.c:587 [inline]
 tun_chr_close+0x44/0x60 drivers/net/tun.c:2592
 __fput+0x327/0x7e0 fs/file_table.c:210
 ____fput+0x15/0x20 fs/file_table.c:246
 task_work_run+0x199/0x270 kernel/task_work.c:112
 exit_task_work include/linux/task_work.h:21 [inline]
 do_exit+0xa52/0x1b30 kernel/exit.c:865
 do_group_exit+0x149/0x400 kernel/exit.c:968
 SYSC_exit_group kernel/exit.c:979 [inline]
 SyS_exit_group+0x1d/0x20 kernel/exit.c:977
 entry_SYSCALL_64_fastpath+0x1f/0xbe
RIP: 0033:0x4512e9
RSP: 002b:0000000000a6f9e8 EFLAGS: 00000206 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000001907914 RCX: 00000000004512e9
RDX: 0000000000000000 RSI: 00000000007643c8 RDI: 0000000000000000
RBP: 0000000000000086 R08: 0000001f0000e9e3 R09: 0000000000000174
R10: 0000000000718000 R11: 0000000000000206 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000042 R15: 000000000000001e

Allocated by task 6825:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 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:551
 kmem_cache_alloc_trace+0x136/0x750 mm/slab.c:3627
 kmalloc include/linux/slab.h:493 [inline]
 dev_map_update_elem+0x1ef/0x320 kernel/bpf/devmap.c:347
 map_update_elem kernel/bpf/syscall.c:581 [inline]
 SYSC_bpf kernel/bpf/syscall.c:1478 [inline]
 SyS_bpf+0x2017/0x5070 kernel/bpf/syscall.c:1453
 entry_SYSCALL_64_fastpath+0x1f/0xbe

Freed by task 1269:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 save_stack+0x43/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0x71/0xc0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3503 [inline]
 kfree+0xca/0x250 mm/slab.c:3820
 dev_map_free+0x299/0x5a0 kernel/bpf/devmap.c:175
 bpf_map_free_deferred+0xac/0xd0 kernel/bpf/syscall.c:208
 process_one_work+0xbf3/0x1bc0 kernel/workqueue.c:2098
 worker_thread+0x223/0x1860 kernel/workqueue.c:2233
 kthread+0x35e/0x430 kernel/kthread.c:231
 ret_from_fork+0x2a/0x40 arch/x86/entry/entry_64.S:431

The buggy address belongs to the object at ffff8801d41f7d00
 which belongs to the cache kmalloc-64 of size 64
The buggy address is located 0 bytes inside of
 64-byte region [ffff8801d41f7d00, ffff8801d41f7d40)
The buggy address belongs to the page:
page:ffffea0007507dc0 count:1 mapcount:0 mapping:ffff8801d41f7000 index:0x0
flags: 0x200000000000100(slab)
raw: 0200000000000100 ffff8801d41f7000 0000000000000000 0000000100000020
raw: ffffea000758e1e0 ffffea00074fa3e0 ffff8801dac00340 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801d41f7c00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8801d41f7c80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff8801d41f7d00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
                   ^
 ffff8801d41f7d80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8801d41f7e00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================

Crashes (5):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2017/08/20 09:51 linux-next bb70832dd42b f238fbd4 .config console log report ci-upstream-next-kasan-gce
2017/08/15 18:02 linux-next 497247033eb1 6a0246bf .config console log report skylake-linux-next-kasan-qemu
2017/08/14 09:48 linux-next 91dfed74eabc 360f0528 .config console log report ci-upstream-next-kasan-gce
2017/08/14 01:54 linux-next 91dfed74eabc 360f0528 .config console log report ci-upstream-next-kasan-gce
2017/08/12 19:00 linux-next 91dfed74eabc 6a0246bf .config console log report skylake-linux-next-kasan-qemu
* Struck through repros no longer work on HEAD.