Re: general protection fault in proc_flush_task

From: Dmitry Vyukov
Date: Thu Nov 30 2017 - 06:29:10 EST


On Thu, Nov 30, 2017 at 12:21 PM, Alexey Dobriyan <adobriyan@xxxxxxxxx> wrote:
> On 11/30/17, syzbot
> <bot+d97f673cce9cfcac0a53a46127f5349b57d7ad3f@xxxxxxxxxxxxxxxxxxxxxxxxx>
> wrote:
>> Hello,
>>
>> syzkaller hit the following crash on
>> 0c86a6bd85ff0629cd2c5141027fc1c8bb6cde9c
>> git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-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
>>
>>
>> kasan: GPF could be caused by NULL-ptr deref or user memory access
>> general protection fault: 0000 [#1] SMP KASAN
>> Dumping ftrace buffer:
>> (ftrace buffer empty)
>> Modules linked in:
>> CPU: 0 PID: 3163 Comm: syz-executor1 Not tainted 4.14.0+ #190
>> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
>> Google 01/01/2011
>> task: ffff8801cbcfa440 task.stack: ffff8801cbc70000
>> RIP: 0010:proc_flush_task_mnt fs/proc/base.c:3028 [inline]
>> RIP: 0010:proc_flush_task+0x26d/0x6c0 fs/proc/base.c:3100
>> RSP: 0018:ffff8801cbc77408 EFLAGS: 00010246
>> RAX: 0000000000000000 RBX: dffffc0000000000 RCX: ffffed003978ee95
>> RDX: 0000000000000000 RSI: dffffc0000000000 RDI: 1ffff1003978ee53
>> RBP: ffff8801cbc77510 R08: 0000000000000000 R09: 1ffff1003978ee0c
>> R10: 0000000000000500 R11: 0000000000000000 R12: ffff8801cbc774a8
>> R13: 0000000000000000 R14: ffff8801c87fce80 R15: ffff8801cbc77468
>> FS: 00000000012dc940(0000) GS:ffff8801db400000(0000)
>> knlGS:0000000000000000
>> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
>> CR2: 00000000208e5ff0 CR3: 00000001cbed4000 CR4: 00000000001406f0
>> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
>> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
>> Call Trace:
>> release_task+0x258/0x1a40 kernel/exit.c:195
>> wait_task_zombie kernel/exit.c:1161 [inline]
>> wait_consider_task+0x2a10/0x3420 kernel/exit.c:1388
>> do_wait_thread kernel/exit.c:1451 [inline]
>> do_wait+0x427/0xa70 kernel/exit.c:1522
>> kernel_wait4+0x1f5/0x370 kernel/exit.c:1665
>> SYSC_wait4+0x134/0x140 kernel/exit.c:1677
>> SyS_wait4+0x2c/0x40 kernel/exit.c:1673
>> entry_SYSCALL_64_fastpath+0x1f/0x96
>> RIP: 0033:0x40cbfa
>> RSP: 002b:0000000000a6fa28 EFLAGS: 00000246 ORIG_RAX: 000000000000003d
>> RAX: ffffffffffffffda RBX: 00000000012dc914 RCX: 000000000040cbfa
>> RDX: 0000000040000001 RSI: 0000000000a6fa4c RDI: ffffffffffffffff
>> RBP: 0000000000000086 R08: 0000000000000001 R09: 00000000012dc940
>> R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
>> R13: 000000000000000a R14: 00000000001a0347 R15: 0000000000000016
>> Code: 7d a0 e8 17 2c 43 03 48 8b 8d 10 ff ff ff 0f b6 11 38 95 33 ff ff ff
>>
>> 7c 08 84 d2 0f 85 73 03 00 00 89 45 9c 4c 89 e8 48 c1 e8 03 <80> 3c 18 00
>> 0f 85 52 03 00 00 49 8b 7d 00 4c 89 e6 e8 8d 93 e7
>> RIP: proc_flush_task_mnt fs/proc/base.c:3028 [inline] RSP: ffff8801cbc77408
>> RIP: proc_flush_task+0x26d/0x6c0 fs/proc/base.c:3100 RSP: ffff8801cbc77408
>
> same here?
>
> cmp BYTE PTR [rax+rbx*1],0x0
>
> RAX 0
> RBX dffffc0000000000


Tat's how dereference on a NULL pointer looks with KASAN. Kernel code
tries to dereference a NULL pointer.