syzbot


KASAN: use-after-free Read in do_get_mempolicy

Status: closed as invalid on 2017/07/28 17:48
First crash: 2462d, last: 2457d

Sample crash report:
IPVS: Creating netns size=2536 id=7
IPVS: Creating netns size=2536 id=8
==================================================================
BUG: KASAN: use-after-free in do_get_mempolicy+0xb41/0xba0 mm/mempolicy.c:938 at addr ffff8801c76e0d26
Read of size 2 by task syz-executor0/5047
CPU: 1 PID: 5047 Comm: syz-executor0 Not tainted 4.9.39-g72a0c9f #6
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
 ffff8801c9a67cf8 ffffffff81eacd59 ffff8801dac0ec80 ffff8801c76e0d20
 ffff8801c76e0d38 ffffed0038edc1a4 ffff8801c76e0d26 ffff8801c9a67d20
 ffffffff81546bfc ffffed0038edc1a4 ffff8801dac0ec80 0000000000000000
Call Trace:
 [<ffffffff81eacd59>] __dump_stack lib/dump_stack.c:15 [inline]
 [<ffffffff81eacd59>] dump_stack+0xc1/0x128 lib/dump_stack.c:51
 [<ffffffff81546bfc>] kasan_object_err+0x1c/0x70 mm/kasan/report.c:160
 [<ffffffff81546ead>] print_address_description mm/kasan/report.c:198 [inline]
 [<ffffffff81546ead>] kasan_report_error mm/kasan/report.c:287 [inline]
 [<ffffffff81546ead>] kasan_report.part.1+0x20d/0x4e0 mm/kasan/report.c:309
 [<ffffffff815471d9>] kasan_report mm/kasan/report.c:328 [inline]
 [<ffffffff815471d9>] __asan_report_load2_noabort+0x29/0x30 mm/kasan/report.c:328
 [<ffffffff8152bf91>] do_get_mempolicy+0xb41/0xba0 mm/mempolicy.c:938
 [<ffffffff8152ca73>] SYSC_get_mempolicy mm/mempolicy.c:1479 [inline]
 [<ffffffff8152ca73>] SyS_get_mempolicy+0xc3/0x190 mm/mempolicy.c:1468
 [<ffffffff83965985>] entry_SYSCALL_64_fastpath+0x23/0xc6
Object at ffff8801c76e0d20, in cache numa_policy size: 24
Allocated:
PID = 5033
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57
 save_stack+0x43/0xd0 mm/kasan/kasan.c:495
 set_track mm/kasan/kasan.c:507 [inline]
 kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:598
 kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:537
 slab_post_alloc_hook mm/slab.h:417 [inline]
 slab_alloc_node mm/slub.c:2715 [inline]
 slab_alloc mm/slub.c:2723 [inline]
 kmem_cache_alloc+0xc9/0x2a0 mm/slub.c:2728
 __mpol_dup+0x79/0x3c0 mm/mempolicy.c:2104
 mpol_dup include/linux/mempolicy.h:89 [inline]
 vma_replace_policy mm/mempolicy.c:703 [inline]
 mbind_range mm/mempolicy.c:776 [inline]
 do_mbind+0x71e/0xb30 mm/mempolicy.c:1240
 SYSC_mbind mm/mempolicy.c:1349 [inline]
 SyS_mbind+0x13b/0x150 mm/mempolicy.c:1331
 entry_SYSCALL_64_fastpath+0x23/0xc6
Freed:
PID = 5021
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57
 save_stack+0x43/0xd0 mm/kasan/kasan.c:495
 set_track mm/kasan/kasan.c:507 [inline]
 kasan_slab_free+0x73/0xc0 mm/kasan/kasan.c:571
 slab_free_hook mm/slub.c:1355 [inline]
 slab_free_freelist_hook mm/slub.c:1377 [inline]
 slab_free mm/slub.c:2958 [inline]
 kmem_cache_free+0xb2/0x2e0 mm/slub.c:2980
 __mpol_put+0x26/0x30 mm/mempolicy.c:299
 mpol_put include/linux/mempolicy.h:67 [inline]
 remove_vma+0x12b/0x1a0 mm/mmap.c:174
 remove_vma_list mm/mmap.c:2482 [inline]
 do_munmap+0x7ff/0xeb0 mm/mmap.c:2705
 mmap_region+0x14d/0xfe0 mm/mmap.c:1635
 do_mmap+0x595/0xbe0 mm/mmap.c:1473
 do_mmap_pgoff include/linux/mm.h:2014 [inline]
 vm_mmap_pgoff+0x158/0x1a0 mm/util.c:305
 SYSC_mmap_pgoff mm/mmap.c:1523 [inline]
 SyS_mmap_pgoff+0x1fc/0x580 mm/mmap.c:1481
 SYSC_mmap arch/x86/kernel/sys_x86_64.c:95 [inline]
 SyS_mmap+0x16/0x20 arch/x86/kernel/sys_x86_64.c:86
 entry_SYSCALL_64_fastpath+0x23/0xc6
Memory state around the buggy address:
 ffff8801c76e0c00: fc fb fb fb fc fc fb fb fb fc fc fb fb fb fc fc
 ffff8801c76e0c80: fb fb fb fc fc fb fb fb fc fc fb fb fb fc fc fb
>ffff8801c76e0d00: fb fb fc fc fb fb fb fc fc fb fb fb fc fc fb fb
                               ^
 ffff8801c76e0d80: fb fc fc fb fb fb fc fc fb fb fb fc fc fb fb fb
 ffff8801c76e0e00: fc fc fb fb fb fc fc fb fb fb fc fc fb fb fb fc
==================================================================
==================================================================
BUG: KASAN: use-after-free in do_get_mempolicy+0xb23/0xba0 mm/mempolicy.c:938 at addr ffff8801c76e0d30
Read of size 8 by task syz-executor0/5047
CPU: 0 PID: 5047 Comm: syz-executor0 Tainted: G    B           4.9.39-g72a0c9f #6
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
 ffff8801c9a67cf8 ffffffff81eacd59 ffff8801dac0ec80 ffff8801c76e0d20
 ffff8801c76e0d38 ffffed0038edc1a6 ffff8801c76e0d30 ffff8801c9a67d20
 ffffffff81546bfc ffffed0038edc1a6 ffff8801dac0ec80 0000000000000000
Call Trace:
 [<ffffffff81eacd59>] __dump_stack lib/dump_stack.c:15 [inline]
 [<ffffffff81eacd59>] dump_stack+0xc1/0x128 lib/dump_stack.c:51
 [<ffffffff81546bfc>] kasan_object_err+0x1c/0x70 mm/kasan/report.c:160
 [<ffffffff81546ead>] print_address_description mm/kasan/report.c:198 [inline]
 [<ffffffff81546ead>] kasan_report_error mm/kasan/report.c:287 [inline]
 [<ffffffff81546ead>] kasan_report.part.1+0x20d/0x4e0 mm/kasan/report.c:309
 [<ffffffff81547239>] kasan_report mm/kasan/report.c:330 [inline]
 [<ffffffff81547239>] __asan_report_load8_noabort+0x29/0x30 mm/kasan/report.c:330
 [<ffffffff8152bf73>] do_get_mempolicy+0xb23/0xba0 mm/mempolicy.c:938
 [<ffffffff8152ca73>] SYSC_get_mempolicy mm/mempolicy.c:1479 [inline]
 [<ffffffff8152ca73>] SyS_get_mempolicy+0xc3/0x190 mm/mempolicy.c:1468
 [<ffffffff83965985>] entry_SYSCALL_64_fastpath+0x23/0xc6
Object at ffff8801c76e0d20, in cache numa_policy size: 24
Allocated:
PID = 5033
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57
 save_stack+0x43/0xd0 mm/kasan/kasan.c:495
 set_track mm/kasan/kasan.c:507 [inline]
 kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:598
 kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:537
 slab_post_alloc_hook mm/slab.h:417 [inline]
 slab_alloc_node mm/slub.c:2715 [inline]
 slab_alloc mm/slub.c:2723 [inline]
 kmem_cache_alloc+0xc9/0x2a0 mm/slub.c:2728
 __mpol_dup+0x79/0x3c0 mm/mempolicy.c:2104
 mpol_dup include/linux/mempolicy.h:89 [inline]
 vma_replace_policy mm/mempolicy.c:703 [inline]
 mbind_range mm/mempolicy.c:776 [inline]
 do_mbind+0x71e/0xb30 mm/mempolicy.c:1240
 SYSC_mbind mm/mempolicy.c:1349 [inline]
 SyS_mbind+0x13b/0x150 mm/mempolicy.c:1331
 entry_SYSCALL_64_fastpath+0x23/0xc6
Freed:
PID = 5021
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57
 save_stack+0x43/0xd0 mm/kasan/kasan.c:495
 set_track mm/kasan/kasan.c:507 [inline]
 kasan_slab_free+0x73/0xc0 mm/kasan/kasan.c:571
 slab_free_hook mm/slub.c:1355 [inline]
 slab_free_freelist_hook mm/slub.c:1377 [inline]
 slab_free mm/slub.c:2958 [inline]
 kmem_cache_free+0xb2/0x2e0 mm/slub.c:2980
 __mpol_put+0x26/0x30 mm/mempolicy.c:299
 mpol_put include/linux/mempolicy.h:67 [inline]
 remove_vma+0x12b/0x1a0 mm/mmap.c:174
 remove_vma_list mm/mmap.c:2482 [inline]
 do_munmap+0x7ff/0xeb0 mm/mmap.c:2705
 mmap_region+0x14d/0xfe0 mm/mmap.c:1635
 do_mmap+0x595/0xbe0 mm/mmap.c:1473
 do_mmap_pgoff include/linux/mm.h:2014 [inline]
 vm_mmap_pgoff+0x158/0x1a0 mm/util.c:305
 SYSC_mmap_pgoff mm/mmap.c:1523 [inline]
 SyS_mmap_pgoff+0x1fc/0x580 mm/mmap.c:1481
 SYSC_mmap arch/x86/kernel/sys_x86_64.c:95 [inline]
 SyS_mmap+0x16/0x20 arch/x86/kernel/sys_x86_64.c:86
 entry_SYSCALL_64_fastpath+0x23/0xc6
Memory state around the buggy address:
 ffff8801c76e0c00: fc fb fb fb fc fc fb fb fb fc fc fb fb fb fc fc
 ffff8801c76e0c80: fb fb fb fc fc fb fb fb fc fc fb fb fb fc fc fb
>ffff8801c76e0d00: fb fb fc fc fb fb fb fc fc fb fb fb fc fc fb fb
                                     ^
 ffff8801c76e0d80: fb fc fc fb fb fb fc fc fb fb fb fc fc fb fb fb
 ffff8801c76e0e00: fc fc fb fb fb fc fc fb fb fb fc fc fb fb fb fc
==================================================================
==================================================================
BUG: KASAN: use-after-free in mpol_needs_cond_ref include/linux/mempolicy.h:76 [inline] at addr ffff8801c76e0d26
BUG: KASAN: use-after-free in mpol_cond_put include/linux/mempolicy.h:81 [inline] at addr ffff8801c76e0d26
BUG: KASAN: use-after-free in do_get_mempolicy+0xaee/0xba0 mm/mempolicy.c:947 at addr ffff8801c76e0d26
Read of size 2 by task syz-executor0/5047
CPU: 0 PID: 5047 Comm: syz-executor0 Tainted: G    B           4.9.39-g72a0c9f #6
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
 ffff8801c9a67cf8 ffffffff81eacd59 ffff8801dac0ec80 ffff8801c76e0d20
 ffff8801c76e0d38 ffffed0038edc1a4 ffff8801c76e0d26 ffff8801c9a67d20
 ffffffff81546bfc ffffed0038edc1a4 ffff8801dac0ec80 0000000000000000
Call Trace:
 [<ffffffff81eacd59>] __dump_stack lib/dump_stack.c:15 [inline]
 [<ffffffff81eacd59>] dump_stack+0xc1/0x128 lib/dump_stack.c:51
 [<ffffffff81546bfc>] kasan_object_err+0x1c/0x70 mm/kasan/report.c:160
 [<ffffffff81546ead>] print_address_description mm/kasan/report.c:198 [inline]
 [<ffffffff81546ead>] kasan_report_error mm/kasan/report.c:287 [inline]
 [<ffffffff81546ead>] kasan_report.part.1+0x20d/0x4e0 mm/kasan/report.c:309
 [<ffffffff815471d9>] kasan_report mm/kasan/report.c:328 [inline]
 [<ffffffff815471d9>] __asan_report_load2_noabort+0x29/0x30 mm/kasan/report.c:328
 [<ffffffff8152bf3e>] mpol_needs_cond_ref include/linux/mempolicy.h:76 [inline]
 [<ffffffff8152bf3e>] mpol_cond_put include/linux/mempolicy.h:81 [inline]
 [<ffffffff8152bf3e>] do_get_mempolicy+0xaee/0xba0 mm/mempolicy.c:947
 [<ffffffff8152ca73>] SYSC_get_mempolicy mm/mempolicy.c:1479 [inline]
 [<ffffffff8152ca73>] SyS_get_mempolicy+0xc3/0x190 mm/mempolicy.c:1468
 [<ffffffff83965985>] entry_SYSCALL_64_fastpath+0x23/0xc6
Object at ffff8801c76e0d20, in cache numa_policy size: 24
Allocated:
PID = 5033
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57
 save_stack+0x43/0xd0 mm/kasan/kasan.c:495
 set_track mm/kasan/kasan.c:507 [inline]
 kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:598
 kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:537
 slab_post_alloc_hook mm/slab.h:417 [inline]
 slab_alloc_node mm/slub.c:2715 [inline]
 slab_alloc mm/slub.c:2723 [inline]
 kmem_cache_alloc+0xc9/0x2a0 mm/slub.c:2728
 __mpol_dup+0x79/0x3c0 mm/mempolicy.c:2104
 mpol_dup include/linux/mempolicy.h:89 [inline]
 vma_replace_policy mm/mempolicy.c:703 [inline]
 mbind_range mm/mempolicy.c:776 [inline]
 do_mbind+0x71e/0xb30 mm/mempolicy.c:1240
 SYSC_mbind mm/mempolicy.c:1349 [inline]
 SyS_mbind+0x13b/0x150 mm/mempolicy.c:1331
 entry_SYSCALL_64_fastpath+0x23/0xc6
Freed:
PID = 5021
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57
 save_stack+0x43/0xd0 mm/kasan/kasan.c:495
 set_track mm/kasan/kasan.c:507 [inline]
 kasan_slab_free+0x73/0xc0 mm/kasan/kasan.c:571
 slab_free_hook mm/slub.c:1355 [inline]
 slab_free_freelist_hook mm/slub.c:1377 [inline]
 slab_free mm/slub.c:2958 [inline]
 kmem_cache_free+0xb2/0x2e0 mm/slub.c:2980
 __mpol_put+0x26/0x30 mm/mempolicy.c:299
 mpol_put include/linux/mempolicy.h:67 [inline]
 remove_vma+0x12b/0x1a0 mm/mmap.c:174
 remove_vma_list mm/mmap.c:2482 [inline]
 do_munmap+0x7ff/0xeb0 mm/mmap.c:2705
 mmap_region+0x14d/0xfe0 mm/mmap.c:1635
 do_mmap+0x595/0xbe0 mm/mmap.c:1473
 do_mmap_pgoff include/linux/mm.h:2014 [inline]
 vm_mmap_pgoff+0x158/0x1a0 mm/util.c:305
 SYSC_mmap_pgoff mm/mmap.c:1523 [inline]
 SyS_mmap_pgoff+0x1fc/0x580 mm/mmap.c:1481
 SYSC_mmap arch/x86/kernel/sys_x86_64.c:95 [inline]
 SyS_mmap+0x16/0x20 arch/x86/kernel/sys_x86_64.c:86
 entry_SYSCALL_64_fastpath+0x23/0xc6
Memory state around the buggy address:
 ffff8801c76e0c00: fc fb fb fb fc fc fb fb fb fc fc fb fb fb fc fc
 ffff8801c76e0c80: fb fb fb fc fc fb fb fb fc fc fb fb fb fc fc fb
>ffff8801c76e0d00: fb fb fc fc fb fb fb fc fc fb fb fb fc fc fb fb
                               ^
 ffff8801c76e0d80: fb fc fc fb fb fb fc fc fb fb fb fc fc fb fb fb
 ffff8801c76e0e00: fc fc fb fb fb fc fc fb fb fb fc fc fb fb fb fc
==================================================================

Crashes (7):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2017/07/26 20:34 https://android.googlesource.com/kernel/common android-4.9 72a0c9f5b54a b0d23a5c .config console log report syz ci-android-49-kasan-gce
2017/07/22 16:15 https://android.googlesource.com/kernel/common android-4.9 5b07c2d25292 b59a95bc .config console log report syz ci-android-49-kasan-gce
2017/07/22 11:28 https://android.googlesource.com/kernel/common android-4.9 5b07c2d25292 b59a95bc .config console log report syz ci-android-49-kasan-gce
2017/07/26 20:02 https://android.googlesource.com/kernel/common android-4.9 72a0c9f5b54a b0d23a5c .config console log report ci-android-49-kasan-gce
2017/07/22 15:41 https://android.googlesource.com/kernel/common android-4.9 5b07c2d25292 b59a95bc .config console log report ci-android-49-kasan-gce
2017/07/22 12:12 https://android.googlesource.com/kernel/common android-4.9 5b07c2d25292 b59a95bc .config console log report ci-android-49-kasan-gce
2017/07/22 11:01 https://android.googlesource.com/kernel/common android-4.9 5b07c2d25292 b59a95bc .config console log report ci-android-49-kasan-gce
* Struck through repros no longer work on HEAD.