syzbot


KASAN: use-after-free Read in tw_timer_handler

Status: auto-closed as invalid on 2020/05/12 09:52
Reported-by: syzbot+445885d03020621fa52b@syzkaller.appspotmail.com
First crash: 1668d, last: 1563d

Sample crash report:
==================================================================
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+0x142/0x197 lib/dump_stack.c:58
 fail_dump lib/fault-inject.c:51 [inline]
 should_fail.cold+0x10f/0x159 lib/fault-inject.c:149
BUG: KASAN: use-after-free in tw_timer_handler+0x124/0x150 net/ipv4/inet_timewait_sock.c:151
 should_failslab+0xdb/0x130 mm/failslab.c:32
Read of size 8 at addr ffff88805dd40378 by task syz-executor.1/9170
 slab_pre_alloc_hook mm/slab.h:421 [inline]
 slab_alloc mm/slab.c:3376 [inline]
 kmem_cache_alloc+0x2d7/0x780 mm/slab.c:3550

 kmem_cache_zalloc include/linux/slab.h:651 [inline]
 inode_alloc_security security/selinux/hooks.c:233 [inline]
 selinux_inode_alloc_security+0xb6/0x2a0 security/selinux/hooks.c:2893
 security_inode_alloc+0x94/0xd0 security/security.c:438
 inode_init_always+0x552/0xaf0 fs/inode.c:167
 alloc_inode+0x81/0x180 fs/inode.c:216
 new_inode_pseudo+0x19/0xf0 fs/inode.c:898
 new_inode+0x1f/0x40 fs/inode.c:927
 rpc_get_inode+0x1d/0x1f0 net/sunrpc/rpc_pipe.c:475
 __rpc_create_common+0x5a/0x1a0 net/sunrpc/rpc_pipe.c:500
 __rpc_mkdir net/sunrpc/rpc_pipe.c:538 [inline]
 rpc_populate.constprop.0+0x122/0x360 net/sunrpc/rpc_pipe.c:734
 rpc_fill_super+0x320/0x900 net/sunrpc/rpc_pipe.c:1405
 mount_ns+0xec/0x190 fs/super.c:1051
 rpc_mount+0xa4/0xd0 net/sunrpc/rpc_pipe.c:1452
 mount_fs+0x97/0x2a1 fs/super.c:1237
 vfs_kern_mount.part.0+0x5e/0x3d0 fs/namespace.c:1046
 vfs_kern_mount fs/namespace.c:1036 [inline]
 do_new_mount fs/namespace.c:2549 [inline]
 do_mount+0x417/0x27d0 fs/namespace.c:2879
 SYSC_mount fs/namespace.c:3095 [inline]
 SyS_mount+0xab/0x120 fs/namespace.c:3072
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x45af49
RSP: 002b:00007fe24d68fc78 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007fe24d68fc90 RCX: 000000000045af49
RDX: 0000000020000000 RSI: 00000000200000c0 RDI: 0000000000000000
RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fe24d6906d4
R13: 00000000004c8583 R14: 00000000004e0748 R15: 0000000000000004
CPU: 0 PID: 9170 Comm: syz-executor.1 Not tainted 4.14.164-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
net/sunrpc/rpc_pipe.c: __rpc_create_common failed to allocate inode for dentry lockd
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x142/0x197 lib/dump_stack.c:58
 print_address_description.cold+0x7c/0x1dc mm/kasan/report.c:252
 kasan_report_error mm/kasan/report.c:351 [inline]
 kasan_report mm/kasan/report.c:409 [inline]
 kasan_report.cold+0xa9/0x2af mm/kasan/report.c:393
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430
 tw_timer_handler+0x124/0x150 net/ipv4/inet_timewait_sock.c:151
 call_timer_fn+0x161/0x670 kernel/time/timer.c:1279
net/sunrpc/rpc_pipe.c: rpc_populate failed to populate directory /
 expire_timers kernel/time/timer.c:1318 [inline]
 __run_timers kernel/time/timer.c:1636 [inline]
 __run_timers kernel/time/timer.c:1604 [inline]
 run_timer_softirq+0x5b7/0x1520 kernel/time/timer.c:1649
FAULT_INJECTION: forcing a failure.
name failslab, interval 1, probability 0, space 0, times 0
 __do_softirq+0x244/0x9a0 kernel/softirq.c:288
 invoke_softirq kernel/softirq.c:368 [inline]
 irq_exit+0x160/0x1b0 kernel/softirq.c:409
 exiting_irq arch/x86/include/asm/apic.h:648 [inline]
 smp_apic_timer_interrupt+0x146/0x5e0 arch/x86/kernel/apic/apic.c:1102
 apic_timer_interrupt+0x96/0xa0 arch/x86/entry/entry_64.S:792
 </IRQ>
RIP: 0010:preempt_schedule_irq+0xab/0x140 kernel/sched/core.c:3611
RSP: 0018:ffff88802ee5f898 EFLAGS: 00000286 ORIG_RAX: ffffffffffffff10
RAX: 1ffffffff0fe2d2b RBX: dffffc0000000000 RCX: 1ffff110112fade9
RDX: 0000000000000000 RSI: ffff8880897d6f28 RDI: ffff8880897d6efc
RBP: ffff88802ee5f8b8 R08: 0000000000000000 R09: ffff8880897d6f48
R10: 0000000000000000 R11: 0000000000000000 R12: ffffed10112facd0
R13: ffff8880897d6680 R14: ffffffff87f16958 R15: 0000000000000000
 retint_kernel+0x1b/0x2d
RIP: 0010:arch_local_irq_restore+0x4e/0x56 arch/x86/include/asm/paravirt.h:779
RSP: 0018:ffff88802ee5f970 EFLAGS: 00000212 ORIG_RAX: ffffffffffffff02
RAX: 0000000000040000 RBX: 0000000000000212 RCX: ffffc90012fa9000
RDX: 0000000000040000 RSI: ffffffff8663b8fc RDI: 0000000000000212
RBP: ffff88802ee5f978 R08: ffff8880897d6680 R09: ffff8880897d6f48
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000212
R13: 1ffffffff0fe2d2a R14: 0000000000000200 R15: dffffc0000000000
 dump_stack+0x185/0x197 lib/dump_stack.c:63
 fail_dump lib/fault-inject.c:51 [inline]
 should_fail.cold+0x10f/0x159 lib/fault-inject.c:149
 should_failslab+0xdb/0x130 mm/failslab.c:32
 slab_pre_alloc_hook mm/slab.h:421 [inline]
 slab_alloc mm/slab.c:3376 [inline]
 kmem_cache_alloc+0x2d7/0x780 mm/slab.c:3550
 rpc_alloc_inode+0x1a/0x20 net/sunrpc/rpc_pipe.c:198
 alloc_inode+0x64/0x180 fs/inode.c:209
 new_inode_pseudo+0x19/0xf0 fs/inode.c:898
 new_inode+0x1f/0x40 fs/inode.c:927
 rpc_get_inode+0x1d/0x1f0 net/sunrpc/rpc_pipe.c:475
 __rpc_create_common+0x5a/0x1a0 net/sunrpc/rpc_pipe.c:500
 __rpc_mkdir net/sunrpc/rpc_pipe.c:538 [inline]
 rpc_populate.constprop.0+0x122/0x360 net/sunrpc/rpc_pipe.c:734
 rpc_fill_super+0x320/0x900 net/sunrpc/rpc_pipe.c:1405
 mount_ns+0xec/0x190 fs/super.c:1051
 rpc_mount+0xa4/0xd0 net/sunrpc/rpc_pipe.c:1452
 mount_fs+0x97/0x2a1 fs/super.c:1237
 vfs_kern_mount.part.0+0x5e/0x3d0 fs/namespace.c:1046
 vfs_kern_mount fs/namespace.c:1036 [inline]
 do_new_mount fs/namespace.c:2549 [inline]
 do_mount+0x417/0x27d0 fs/namespace.c:2879
 SYSC_mount fs/namespace.c:3095 [inline]
 SyS_mount+0xab/0x120 fs/namespace.c:3072
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x45af49
RSP: 002b:00007f9f9dd64c78 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007f9f9dd64c90 RCX: 000000000045af49
RDX: 0000000020000000 RSI: 00000000200000c0 RDI: 0000000000000000
RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f9f9dd656d4
R13: 00000000004c8583 R14: 00000000004e0748 R15: 0000000000000004

Allocated by task 7418:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 save_stack+0x45/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc mm/kasan/kasan.c:551 [inline]
 kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:529
 kasan_slab_alloc+0xf/0x20 mm/kasan/kasan.c:489
 kmem_cache_alloc+0x12e/0x780 mm/slab.c:3552
 kmem_cache_zalloc include/linux/slab.h:651 [inline]
 net_alloc net/core/net_namespace.c:362 [inline]
 copy_net_ns+0xfa/0x440 net/core/net_namespace.c:402
 create_new_namespaces+0x37b/0x720 kernel/nsproxy.c:107
 unshare_nsproxy_namespaces+0xab/0x1e0 kernel/nsproxy.c:206
 SYSC_unshare kernel/fork.c:2391 [inline]
 SyS_unshare+0x2f3/0x7e0 kernel/fork.c:2341
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 27720:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 save_stack+0x45/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0x75/0xc0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3496 [inline]
 kmem_cache_free+0x83/0x2b0 mm/slab.c:3758
 net_free net/core/net_namespace.c:378 [inline]
 net_drop_ns+0x6e/0x80 net/core/net_namespace.c:385
 cleanup_net+0x4e9/0x870 net/core/net_namespace.c:502
 process_one_work+0x863/0x1600 kernel/workqueue.c:2114
 worker_thread+0x5d9/0x1050 kernel/workqueue.c:2248
 kthread+0x319/0x430 kernel/kthread.c:232
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

The buggy address belongs to the object at ffff88805dd40180
 which belongs to the cache net_namespace of size 8832
The buggy address is located 504 bytes inside of
 8832-byte region [ffff88805dd40180, ffff88805dd42400)
The buggy address belongs to the page:
page:ffffea0001775000 count:1 mapcount:0 mapping:ffff88805dd40180 index:0x0 compound_mapcount: 0
flags: 0xfffe0000008100(slab|head)
raw: 00fffe0000008100 ffff88805dd40180 0000000000000000 0000000100000001
raw: ffffea0001774420 ffffea0001580320 ffff8880aa9e93c0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88805dd40200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88805dd40280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88805dd40300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                                ^
 ffff88805dd40380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88805dd40400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/01/13 09:52 linux-4.14.y 6d0c334a400d 53faa9fe .config console log report ci2-linux-4-14
2019/12/12 21:38 linux-4.14.y a844dc4c5442 08003f64 .config console log report ci2-linux-4-14
2019/11/23 11:56 linux-4.14.y f56f3d0e65ad 598ca6c8 .config console log report ci2-linux-4-14
2019/09/30 23:03 linux-4.14.y f6e27dbb1afa c7a4fb99 .config console log report ci2-linux-4-14
* Struck through repros no longer work on HEAD.