lkml.org 
[lkml]   [2019]   [Feb]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
Subjectmissing stack trace entry on NULL pointer call [was: Re: BUG: unable to handle kernel NULL pointer dereference in __generic_file_write_iter]
+Josh for unwinding, +x86 folks

On Wed, Feb 27, 2019 at 11:43 PM Andrew Morton
<akpm@linux-foundation.org> wrote:
> On Thu, 21 Feb 2019 06:52:04 -0800 syzbot <syzbot+ca95b2b7aef9e7cbd6ab@syzkaller.appspotmail.com> wrote:
>
> > Hello,
> >
> > syzbot found the following crash on:
> >
> > HEAD commit: 4aa9fc2a435a Revert "mm, memory_hotplug: initialize struct..
> > git tree: upstream
> > console output: https://syzkaller.appspot.com/x/log.txt?x=1101382f400000
> > kernel config: https://syzkaller.appspot.com/x/.config?x=4fceea9e2d99ac20
> > dashboard link: https://syzkaller.appspot.com/bug?extid=ca95b2b7aef9e7cbd6ab
> > compiler: gcc (GCC) 9.0.0 20181231 (experimental)
> >
> > Unfortunately, I don't have any reproducer for this crash yet.
>
> Not understanding. That seems to be saying that we got a NULL pointer
> deref in __generic_file_write_iter() at
>
> written = generic_perform_write(file, from, iocb->ki_pos);
>
> which isn't possible.
>
> I'm not seeing recent changes in there which could have caused this. Help.

+

Maybe the problem is that the frame pointer unwinder isn't designed to
cope with NULL function pointers - or more generally, with an
unwinding operation that starts before the function's frame pointer
has been set up?

Unwinding starts at show_trace_log_lvl(). That begins with
unwind_start(), which calls __unwind_start(), which uses
get_frame_pointer(), which just returns regs->bp. But that frame
pointer points to the part of the stack that's storing the address of
the caller of the function that called NULL; the caller of NULL is
skipped, as far as I can tell.

What's kind of annoying here is that we don't have a proper frame set
up yet, we only have half a stack frame (saved RIP but no saved RBP).

> > IMPORTANT: if you fix the bug, please add the following tag to the commit:
> > Reported-by: syzbot+ca95b2b7aef9e7cbd6ab@syzkaller.appspotmail.com
> >
> > BUG: unable to handle kernel NULL pointer dereference at 0000000000000000
> > #PF error: [INSTR]
> > PGD a7ea0067 P4D a7ea0067 PUD 81535067 PMD 0
> > Oops: 0010 [#1] PREEMPT SMP KASAN
> > CPU: 0 PID: 15924 Comm: syz-executor0 Not tainted 5.0.0-rc4+ #50
> > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> > Google 01/01/2011
> > RIP: 0010: (null)
> > Code: Bad RIP value.
> > RSP: 0018:ffff88804c3d7858 EFLAGS: 00010246
> > RAX: 0000000000000000 RBX: ffffffff885aeb60 RCX: 000000000000005b
> > RDX: 0000000000000000 RSI: ffff88807ec22930 RDI: ffff8880a59bdcc0
> > RBP: ffff88804c3d79b8 R08: 0000000000000000 R09: ffff88804c3d7910
> > R10: ffff8880835ca200 R11: 0000000000000000 R12: 000000000000005b
> > R13: ffff88804c3d7c98 R14: dffffc0000000000 R15: 0000000000000000
> > FS: 00007f3456db4700(0000) GS:ffff8880ae600000(0000) knlGS:0000000000000000
> > CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> > CR2: ffffffffffffffd6 CR3: 00000000814ac000 CR4: 00000000001406f0
> > DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> > DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> > Call Trace:
> > __generic_file_write_iter+0x25e/0x630 mm/filemap.c:3333
> > ext4_file_write_iter+0x37a/0x1410 fs/ext4/file.c:266
> > call_write_iter include/linux/fs.h:1862 [inline]
> > new_sync_write fs/read_write.c:474 [inline]
> > __vfs_write+0x764/0xb40 fs/read_write.c:487
> > vfs_write+0x20c/0x580 fs/read_write.c:549
> > ksys_write+0x105/0x260 fs/read_write.c:598
> > __do_sys_write fs/read_write.c:610 [inline]
> > __se_sys_write fs/read_write.c:607 [inline]
> > __x64_sys_write+0x73/0xb0 fs/read_write.c:607
> > do_syscall_64+0x1a3/0x800 arch/x86/entry/common.c:290
> > entry_SYSCALL_64_after_hwframe+0x49/0xbe
> > RIP: 0033:0x458089
> > Code: 6d b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7
> > 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff
> > ff 0f 83 3b b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00
> > RSP: 002b:00007f3456db3c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
> > RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000458089
> > RDX: 000000000000005b RSI: 0000000020000240 RDI: 0000000000000003
> > RBP: 000000000073bf00 R08: 0000000000000000 R09: 0000000000000000
> > R10: 0000000000000000 R11: 0000000000000246 R12: 00007f3456db46d4
> > R13: 00000000004c7450 R14: 00000000004dce68 R15: 00000000ffffffff
> > Modules linked in:
> > CR2: 0000000000000000
> > ---[ end trace 5cac9d2c75a59916 ]---
> > kobject: 'loop5' (000000004426a409): kobject_uevent_env
> > RIP: 0010: (null)
> > Code: Bad RIP value.
> > RSP: 0018:ffff88804c3d7858 EFLAGS: 00010246
> > RAX: 0000000000000000 RBX: ffffffff885aeb60 RCX: 000000000000005b
> > kobject: 'loop5' (000000004426a409): fill_kobj_path: path
> > = '/devices/virtual/block/loop5'
> > RDX: 0000000000000000 RSI: ffff88807ec22930 RDI: ffff8880a59bdcc0
> > kobject: 'loop2' (00000000b82e0c58): kobject_uevent_env
> > kobject: 'loop2' (00000000b82e0c58): fill_kobj_path: path
> > = '/devices/virtual/block/loop2'
> > RBP: ffff88804c3d79b8 R08: 0000000000000000 R09: ffff88804c3d7910
> > R10: ffff8880835ca200 R11: 0000000000000000 R12: 000000000000005b
> > R13: ffff88804c3d7c98 R14: dffffc0000000000 R15: 0000000000000000
> > kobject: 'loop5' (000000004426a409): kobject_uevent_env
> > FS: 00007f3456db4700(0000) GS:ffff8880ae600000(0000) knlGS:0000000000000000
> > kobject: 'loop5' (000000004426a409): fill_kobj_path: path
> > = '/devices/virtual/block/loop5'
> > CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> > CR2: 00000000022029a0 CR3: 00000000814ac000 CR4: 00000000001406f0
> > DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> > DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> >
> >
> > ---
> > This bug is generated by a bot. It may contain errors.
> > See https://goo.gl/tpsmEJ for more information about syzbot.
> > syzbot engineers can be reached at syzkaller@googlegroups.com.
> >
> > syzbot will keep track of this bug report. See:
> > https://goo.gl/tpsmEJ#bug-status-tracking for how to communicate with
> > syzbot.
>

\
 
 \ /
  Last update: 2019-02-28 00:14    [W:0.067 / U:7.588 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site