Re: BUG: unable to handle kernel NULL pointer dereference in proc_flush_task

From: Eric Biggers
Date: Fri Jan 26 2018 - 18:47:39 EST


On Tue, Dec 19, 2017 at 11:49:02PM -0800, syzbot wrote:
> Hello,
>
> syzkaller hit the following crash on
> 6084b576dca2e898f5c101baef151f7bfdbb606d
> git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/master
> compiler: gcc (GCC) 7.1.1 20170620
> .config is attached
> Raw console output is attached.
>
> syzkaller reproducer is attached. See https://goo.gl/kgGztJ
> for information about syzkaller reproducers
>
>
> BUG: unable to handle kernel NULL pointer dereference at (null)
> IP: proc_flush_task_mnt fs/proc/base.c:3056 [inline]
> IP: proc_flush_task+0x8a/0x1c0 fs/proc/base.c:3128
> PGD 214dd0067 P4D 214dd0067 PUD 2137d6067 PMD 0
> Oops: 0000 [#1] SMP
> Dumping ftrace buffer:
> (ftrace buffer empty)
> Modules linked in:
> CPU: 0 PID: 3142 Comm: syz-executor3 Not tainted 4.15.0-rc3-next-20171214+
> #67
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> Google 01/01/2011
> RIP: 0010:proc_flush_task_mnt fs/proc/base.c:3056 [inline]
> RIP: 0010:proc_flush_task+0x8a/0x1c0 fs/proc/base.c:3128
> RSP: 0018:ffffc9000189bc30 EFLAGS: 00010282
> RAX: 0000000000000001 RBX: 0000000000000002 RCX: ffffffff825bf264
> RDX: 0000000000000000 RSI: ffffc9000189bc58 RDI: ffffc9000189bc4d
> RBP: ffffc9000189bc90 R08: 0000000000000000 R09: 0000000000000002
> R10: ffffc9000189bad8 R11: 0000000000000002 R12: ffffc9000189bc4d
> R13: 0000000000000004 R14: 0000000000000000 R15: 0000000000000004
> FS: 0000000001470940(0000) GS:ffff88021fc00000(0000) knlGS:0000000000000000
> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 0000000000000000 CR3: 0000000213771003 CR4: 00000000001606f0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> Call Trace:
> release_task+0xf4/0x750 kernel/exit.c:195
> wait_task_zombie kernel/exit.c:1165 [inline]
> wait_consider_task+0xe83/0xfb0 kernel/exit.c:1392
> do_wait_thread kernel/exit.c:1455 [inline]
> do_wait+0x189/0x3d0 kernel/exit.c:1526
> kernel_wait4+0xac/0x170 kernel/exit.c:1669
> SYSC_wait4+0xb0/0xc0 kernel/exit.c:1681
> SyS_wait4+0x2c/0x40 kernel/exit.c:1677
> entry_SYSCALL_64_fastpath+0x1f/0x96
> RIP: 0033:0x40cdba
> RSP: 002b:00007fff9cfdb6b8 EFLAGS: 00000246 ORIG_RAX: 000000000000003d
> RAX: ffffffffffffffda RBX: 0000000001470914 RCX: 000000000040cdba
> RDX: 0000000040000001 RSI: 00007fff9cfdb6dc RDI: ffffffffffffffff
> RBP: 00000000000024a9 R08: 0000000000000001 R09: 0000000001470940
> R10: 0000000000000000 R11: 0000000000000246 R12: 00000000000024a9
> R13: 000000000000001f R14: 000000000002eceb R15: 0000000000000001
> Code: d0 48 c1 e2 04 44 8b 3c 11 48 c7 c2 ec d7 f5 82 44 8b 68 30 48 8b 40
> 38 4c 8b 70 58 44 89 e9 e8 dd 83 10 01 89 45 cc 48 8d 75 c8 <49> 8b 3e e8 6e
> 9d f7 ff 48 85 c0 48 89 45 a8 74 1d e8 60 2d e0
> RIP: proc_flush_task_mnt fs/proc/base.c:3056 [inline] RSP: ffffc9000189bc30
> RIP: proc_flush_task+0x8a/0x1c0 fs/proc/base.c:3128 RSP: ffffc9000189bc30
> CR2: 0000000000000000
> ---[ end trace 96968f6879f5e625 ]---
>
>
> ---
> This bug is generated by a dumb bot. It may contain errors.
> See https://goo.gl/tpsmEJ for details.
> Direct all questions to syzkaller@xxxxxxxxxxxxxxxxx
> Please credit me with: Reported-by: syzbot <syzkaller@xxxxxxxxxxxxxxxx>
>
> syzbot will keep track of this bug report.
> Once a fix for this bug is merged into any tree, reply to this email with:
> #syz fix: exact-commit-title

#syz fix: pid: Handle failure to allocate the first pid in a pid namespace