2018-06-13 16:28:25

by syzbot

[permalink] [raw]
Subject: KASAN: use-after-free Read in blkdev_get

Hello,

syzbot found the following crash on:

HEAD commit: f5b7769eb040 Revert "debugfs: inode: debugfs_create_dir us..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=171dc837800000
kernel config: https://syzkaller.appspot.com/x/.config?x=709f8187af941e84
dashboard link: https://syzkaller.appspot.com/bug?extid=eaeb616d85c9a0afec7d
compiler: gcc (GCC) 8.0.1 20180413 (experimental)
syzkaller repro:https://syzkaller.appspot.com/x/repro.syz?x=177f898f800000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=147eb85f800000

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: [email protected]

reiserfs: using flush barriers
REISERFS warning (device loop4): sh-2022 reiserfs_fill_super: unable to
initialize journal space
REISERFS (device loop3): using ordered data mode
reiserfs: using flush barriers
==================================================================
BUG: KASAN: use-after-free in __lock_acquire+0x3888/0x5140
kernel/locking/lockdep.c:3314
Read of size 8 at addr ffff8801a78932f8 by task syz-executor927/4536

CPU: 1 PID: 4536 Comm: syz-executor927 Not tainted 4.17.0+ #100
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x1b9/0x294 lib/dump_stack.c:113
print_address_description+0x6c/0x20b mm/kasan/report.c:256
kasan_report_error mm/kasan/report.c:354 [inline]
kasan_report.cold.7+0x242/0x2fe mm/kasan/report.c:412
__asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433
__lock_acquire+0x3888/0x5140 kernel/locking/lockdep.c:3314
lock_acquire+0x1dc/0x520 kernel/locking/lockdep.c:3924
__mutex_lock_common kernel/locking/mutex.c:757 [inline]
__mutex_lock+0x16d/0x17f0 kernel/locking/mutex.c:894
mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:909
blkdev_get+0x5d8/0xb30 fs/block_dev.c:1620
blkdev_get_by_dev+0x3f/0x80 fs/block_dev.c:1736
journal_init_dev fs/reiserfs/journal.c:2628 [inline]
journal_init+0xcad/0x6a20 fs/reiserfs/journal.c:2775
reiserfs_fill_super+0xd59/0x3900 fs/reiserfs/super.c:2034
mount_bdev+0x30c/0x3e0 fs/super.c:1174
get_super_block+0x34/0x40 fs/reiserfs/super.c:2605
mount_fs+0xae/0x328 fs/super.c:1277
vfs_kern_mount.part.34+0xd4/0x4d0 fs/namespace.c:1037
vfs_kern_mount fs/namespace.c:1027 [inline]
do_new_mount fs/namespace.c:2518 [inline]
do_mount+0x564/0x30b0 fs/namespace.c:2848
ksys_mount+0x12d/0x140 fs/namespace.c:3064
__do_sys_mount fs/namespace.c:3078 [inline]
__se_sys_mount fs/namespace.c:3075 [inline]
__x64_sys_mount+0xbe/0x150 fs/namespace.c:3075
do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x446fda
Code: b8 08 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 1d aa fb ff c3 66 2e 0f
1f 84 00 00 00 00 00 66 90 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff
ff 0f 83 fa a9 fb ff c3 66 0f 1f 84 00 00 00 00 00
RSP: 002b:00007fffcf4ce188 EFLAGS: 00000297 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007fffcf4ce1a0 RCX: 0000000000446fda
RDX: 00007fffcf4ce1a0 RSI: 0000000020000100 RDI: 00007fffcf4ce1c0
RBP: 0000000000000001 R08: 00007fffcf4ce200 R09: 000000000000000a
R10: 0000000000000000 R11: 0000000000000297 R12: 0000000000000003
R13: 0000000000000004 R14: 0000000000000000 R15: 0000000000000001

Allocated by task 4536:
save_stack+0x43/0xd0 mm/kasan/kasan.c:448
set_track mm/kasan/kasan.c:460 [inline]
kasan_kmalloc+0xc4/0xe0 mm/kasan/kasan.c:553
kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:490
kmem_cache_alloc+0x12e/0x760 mm/slab.c:3554
bdev_alloc_inode+0x1b/0x40 fs/block_dev.c:727
alloc_inode+0x63/0x190 fs/inode.c:210
new_inode_pseudo+0x69/0x1a0 fs/inode.c:895
new_inode+0x1c/0x40 fs/inode.c:924
iget5_locked+0x126/0x190 fs/inode.c:1097
bdget+0xb1/0x5c0 fs/block_dev.c:868
blkdev_get_by_dev+0x24/0x80 fs/block_dev.c:1732
journal_init_dev fs/reiserfs/journal.c:2628 [inline]
journal_init+0xcad/0x6a20 fs/reiserfs/journal.c:2775
reiserfs_fill_super+0xd59/0x3900 fs/reiserfs/super.c:2034
mount_bdev+0x30c/0x3e0 fs/super.c:1174
get_super_block+0x34/0x40 fs/reiserfs/super.c:2605
mount_fs+0xae/0x328 fs/super.c:1277
vfs_kern_mount.part.34+0xd4/0x4d0 fs/namespace.c:1037
vfs_kern_mount fs/namespace.c:1027 [inline]
do_new_mount fs/namespace.c:2518 [inline]
do_mount+0x564/0x30b0 fs/namespace.c:2848
ksys_mount+0x12d/0x140 fs/namespace.c:3064
__do_sys_mount fs/namespace.c:3078 [inline]
__se_sys_mount fs/namespace.c:3075 [inline]
__x64_sys_mount+0xbe/0x150 fs/namespace.c:3075
do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 2414:
save_stack+0x43/0xd0 mm/kasan/kasan.c:448
set_track mm/kasan/kasan.c:460 [inline]
__kasan_slab_free+0x11a/0x170 mm/kasan/kasan.c:521
kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
__cache_free mm/slab.c:3498 [inline]
kmem_cache_free+0x86/0x2d0 mm/slab.c:3756
bdev_i_callback+0x20/0x30 fs/block_dev.c:738
__rcu_reclaim kernel/rcu/rcu.h:178 [inline]
rcu_do_batch kernel/rcu/tree.c:2558 [inline]
invoke_rcu_callbacks kernel/rcu/tree.c:2818 [inline]
__rcu_process_callbacks kernel/rcu/tree.c:2785 [inline]
rcu_process_callbacks+0xe9d/0x1760 kernel/rcu/tree.c:2802
__do_softirq+0x2e0/0xaf5 kernel/softirq.c:284

The buggy address belongs to the object at ffff8801a7893280
which belongs to the cache bdev_cache of size 1352
The buggy address is located 120 bytes inside of
1352-byte region [ffff8801a7893280, ffff8801a78937c8)
The buggy address belongs to the page:
page:ffffea00069e24c0 count:1 mapcount:0 mapping:ffff8801da9874c0
index:0xffff8801a7893ffe
flags: 0x2fffc0000000100(slab)
raw: 02fffc0000000100 ffffea0006dfab08 ffffea00069e2508 ffff8801da9874c0
raw: ffff8801a7893ffe ffff8801a7893280 0000000100000002 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8801a7893180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8801a7893200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
> ffff8801a7893280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8801a7893300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8801a7893380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
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 [email protected].

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#bug-status-tracking for how to communicate with
syzbot.
syzbot can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches


2018-12-05 19:52:27

by Dmitry Vyukov

[permalink] [raw]
Subject: Re: KASAN: use-after-free Read in blkdev_get

On Wed, Jun 13, 2018 at 6:27 PM syzbot
<[email protected]> wrote:
>
> Hello,
>
> syzbot found the following crash on:
>
> HEAD commit: f5b7769eb040 Revert "debugfs: inode: debugfs_create_dir us..
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=171dc837800000
> kernel config: https://syzkaller.appspot.com/x/.config?x=709f8187af941e84
> dashboard link: https://syzkaller.appspot.com/bug?extid=eaeb616d85c9a0afec7d
> compiler: gcc (GCC) 8.0.1 20180413 (experimental)
> syzkaller repro:https://syzkaller.appspot.com/x/repro.syz?x=177f898f800000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=147eb85f800000

Was this fixed by something? This happened 108 times in Jun-Aug, then
last time on Sep 2, and then stopped happened since then.

> IMPORTANT: if you fix the bug, please add the following tag to the commit:
> Reported-by: [email protected]
>
> reiserfs: using flush barriers
> REISERFS warning (device loop4): sh-2022 reiserfs_fill_super: unable to
> initialize journal space
> REISERFS (device loop3): using ordered data mode
> reiserfs: using flush barriers
> ==================================================================
> BUG: KASAN: use-after-free in __lock_acquire+0x3888/0x5140
> kernel/locking/lockdep.c:3314
> Read of size 8 at addr ffff8801a78932f8 by task syz-executor927/4536
>
> CPU: 1 PID: 4536 Comm: syz-executor927 Not tainted 4.17.0+ #100
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> Google 01/01/2011
> Call Trace:
> __dump_stack lib/dump_stack.c:77 [inline]
> dump_stack+0x1b9/0x294 lib/dump_stack.c:113
> print_address_description+0x6c/0x20b mm/kasan/report.c:256
> kasan_report_error mm/kasan/report.c:354 [inline]
> kasan_report.cold.7+0x242/0x2fe mm/kasan/report.c:412
> __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433
> __lock_acquire+0x3888/0x5140 kernel/locking/lockdep.c:3314
> lock_acquire+0x1dc/0x520 kernel/locking/lockdep.c:3924
> __mutex_lock_common kernel/locking/mutex.c:757 [inline]
> __mutex_lock+0x16d/0x17f0 kernel/locking/mutex.c:894
> mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:909
> blkdev_get+0x5d8/0xb30 fs/block_dev.c:1620
> blkdev_get_by_dev+0x3f/0x80 fs/block_dev.c:1736
> journal_init_dev fs/reiserfs/journal.c:2628 [inline]
> journal_init+0xcad/0x6a20 fs/reiserfs/journal.c:2775
> reiserfs_fill_super+0xd59/0x3900 fs/reiserfs/super.c:2034
> mount_bdev+0x30c/0x3e0 fs/super.c:1174
> get_super_block+0x34/0x40 fs/reiserfs/super.c:2605
> mount_fs+0xae/0x328 fs/super.c:1277
> vfs_kern_mount.part.34+0xd4/0x4d0 fs/namespace.c:1037
> vfs_kern_mount fs/namespace.c:1027 [inline]
> do_new_mount fs/namespace.c:2518 [inline]
> do_mount+0x564/0x30b0 fs/namespace.c:2848
> ksys_mount+0x12d/0x140 fs/namespace.c:3064
> __do_sys_mount fs/namespace.c:3078 [inline]
> __se_sys_mount fs/namespace.c:3075 [inline]
> __x64_sys_mount+0xbe/0x150 fs/namespace.c:3075
> do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:290
> entry_SYSCALL_64_after_hwframe+0x49/0xbe
> RIP: 0033:0x446fda
> Code: b8 08 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 1d aa fb ff c3 66 2e 0f
> 1f 84 00 00 00 00 00 66 90 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff
> ff 0f 83 fa a9 fb ff c3 66 0f 1f 84 00 00 00 00 00
> RSP: 002b:00007fffcf4ce188 EFLAGS: 00000297 ORIG_RAX: 00000000000000a5
> RAX: ffffffffffffffda RBX: 00007fffcf4ce1a0 RCX: 0000000000446fda
> RDX: 00007fffcf4ce1a0 RSI: 0000000020000100 RDI: 00007fffcf4ce1c0
> RBP: 0000000000000001 R08: 00007fffcf4ce200 R09: 000000000000000a
> R10: 0000000000000000 R11: 0000000000000297 R12: 0000000000000003
> R13: 0000000000000004 R14: 0000000000000000 R15: 0000000000000001
>
> Allocated by task 4536:
> save_stack+0x43/0xd0 mm/kasan/kasan.c:448
> set_track mm/kasan/kasan.c:460 [inline]
> kasan_kmalloc+0xc4/0xe0 mm/kasan/kasan.c:553
> kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:490
> kmem_cache_alloc+0x12e/0x760 mm/slab.c:3554
> bdev_alloc_inode+0x1b/0x40 fs/block_dev.c:727
> alloc_inode+0x63/0x190 fs/inode.c:210
> new_inode_pseudo+0x69/0x1a0 fs/inode.c:895
> new_inode+0x1c/0x40 fs/inode.c:924
> iget5_locked+0x126/0x190 fs/inode.c:1097
> bdget+0xb1/0x5c0 fs/block_dev.c:868
> blkdev_get_by_dev+0x24/0x80 fs/block_dev.c:1732
> journal_init_dev fs/reiserfs/journal.c:2628 [inline]
> journal_init+0xcad/0x6a20 fs/reiserfs/journal.c:2775
> reiserfs_fill_super+0xd59/0x3900 fs/reiserfs/super.c:2034
> mount_bdev+0x30c/0x3e0 fs/super.c:1174
> get_super_block+0x34/0x40 fs/reiserfs/super.c:2605
> mount_fs+0xae/0x328 fs/super.c:1277
> vfs_kern_mount.part.34+0xd4/0x4d0 fs/namespace.c:1037
> vfs_kern_mount fs/namespace.c:1027 [inline]
> do_new_mount fs/namespace.c:2518 [inline]
> do_mount+0x564/0x30b0 fs/namespace.c:2848
> ksys_mount+0x12d/0x140 fs/namespace.c:3064
> __do_sys_mount fs/namespace.c:3078 [inline]
> __se_sys_mount fs/namespace.c:3075 [inline]
> __x64_sys_mount+0xbe/0x150 fs/namespace.c:3075
> do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:290
> entry_SYSCALL_64_after_hwframe+0x49/0xbe
>
> Freed by task 2414:
> save_stack+0x43/0xd0 mm/kasan/kasan.c:448
> set_track mm/kasan/kasan.c:460 [inline]
> __kasan_slab_free+0x11a/0x170 mm/kasan/kasan.c:521
> kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
> __cache_free mm/slab.c:3498 [inline]
> kmem_cache_free+0x86/0x2d0 mm/slab.c:3756
> bdev_i_callback+0x20/0x30 fs/block_dev.c:738
> __rcu_reclaim kernel/rcu/rcu.h:178 [inline]
> rcu_do_batch kernel/rcu/tree.c:2558 [inline]
> invoke_rcu_callbacks kernel/rcu/tree.c:2818 [inline]
> __rcu_process_callbacks kernel/rcu/tree.c:2785 [inline]
> rcu_process_callbacks+0xe9d/0x1760 kernel/rcu/tree.c:2802
> __do_softirq+0x2e0/0xaf5 kernel/softirq.c:284
>
> The buggy address belongs to the object at ffff8801a7893280
> which belongs to the cache bdev_cache of size 1352
> The buggy address is located 120 bytes inside of
> 1352-byte region [ffff8801a7893280, ffff8801a78937c8)
> The buggy address belongs to the page:
> page:ffffea00069e24c0 count:1 mapcount:0 mapping:ffff8801da9874c0
> index:0xffff8801a7893ffe
> flags: 0x2fffc0000000100(slab)
> raw: 02fffc0000000100 ffffea0006dfab08 ffffea00069e2508 ffff8801da9874c0
> raw: ffff8801a7893ffe ffff8801a7893280 0000000100000002 0000000000000000
> page dumped because: kasan: bad access detected
>
> Memory state around the buggy address:
> ffff8801a7893180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
> ffff8801a7893200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
> > ffff8801a7893280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> ^
> ffff8801a7893300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> ffff8801a7893380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> ==================================================================
>
>
> ---
> 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 [email protected].
>
> syzbot will keep track of this bug report. See:
> https://goo.gl/tpsmEJ#bug-status-tracking for how to communicate with
> syzbot.
> syzbot can test patches for this bug, for details see:
> https://goo.gl/tpsmEJ#testing-patches
>
> --
> You received this message because you are subscribed to the Google Groups "syzkaller-bugs" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/msgid/syzkaller-bugs/000000000000e59aab056e8873ae%40google.com.
> For more options, visit https://groups.google.com/d/optout.

2019-11-24 19:10:16

by syzbot

[permalink] [raw]
Subject: Re: KASAN: use-after-free Read in blkdev_get

syzbot has bisected this bug to:

commit 77ef8f5177599efd0cedeb52c1950c1bd73fa5e3
Author: Chris Metcalf <[email protected]>
Date: Mon Jan 25 20:05:34 2016 +0000

tile kgdb: fix bug in copy to gdb regs, and optimize memset

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=1131bc0ee00000
start commit: f5b7769e Revert "debugfs: inode: debugfs_create_dir uses m..
git tree: upstream
final crash: https://syzkaller.appspot.com/x/report.txt?x=1331bc0ee00000
console output: https://syzkaller.appspot.com/x/log.txt?x=1531bc0ee00000
kernel config: https://syzkaller.appspot.com/x/.config?x=709f8187af941e84
dashboard link: https://syzkaller.appspot.com/bug?extid=eaeb616d85c9a0afec7d
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=177f898f800000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=147eb85f800000

Reported-by: [email protected]
Fixes: 77ef8f517759 ("tile kgdb: fix bug in copy to gdb regs, and optimize
memset")

For information about bisection process see: https://goo.gl/tpsmEJ#bisection

2019-11-24 19:32:40

by Al Viro

[permalink] [raw]
Subject: Re: KASAN: use-after-free Read in blkdev_get

On Sun, Nov 24, 2019 at 11:07:00AM -0800, syzbot wrote:
> syzbot has bisected this bug to:
>
> commit 77ef8f5177599efd0cedeb52c1950c1bd73fa5e3
> Author: Chris Metcalf <[email protected]>
> Date: Mon Jan 25 20:05:34 2016 +0000
>
> tile kgdb: fix bug in copy to gdb regs, and optimize memset
>
> bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=1131bc0ee00000
> start commit: f5b7769e Revert "debugfs: inode: debugfs_create_dir uses m..
> git tree: upstream
> final crash: https://syzkaller.appspot.com/x/report.txt?x=1331bc0ee00000
> console output: https://syzkaller.appspot.com/x/log.txt?x=1531bc0ee00000
> kernel config: https://syzkaller.appspot.com/x/.config?x=709f8187af941e84
> dashboard link: https://syzkaller.appspot.com/bug?extid=eaeb616d85c9a0afec7d
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=177f898f800000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=147eb85f800000
>
> Reported-by: [email protected]
> Fixes: 77ef8f517759 ("tile kgdb: fix bug in copy to gdb regs, and optimize
> memset")
>
> For information about bisection process see: https://goo.gl/tpsmEJ#bisection

Seriously? How can the commit in question (limited to arch/tile/kernel/kgdb.c)
possibly affect a bug that manages to produce a crash report with
RSP: 0018:ffffffff82e03eb8 EFLAGS: 00000282
RAX: 0000000000000000 RBX: ffffffff82e00000 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffff81088779
RBP: ffffffff82e03eb8 R08: 0000000000000000 R09: 0000000000000001
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: ffffffff82e00000
FS: 0000000000000000(0000) GS:ffff88021fc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000000c420447ff8 CR3: 0000000213184000 CR4: 00000000001406f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
in it? Unless something very odd has happened to tile, this crash has
been observed on 64bit x86; the names of registers alone are enough
to be certain of that.

And the binaries produced by an x86 build should not be affected by any
changes in arch/tile; not unless something is very wrong with the build
system. It's not even that this commit has fixed an earlier bug that
used to mask the one manifested here - it really should have had zero
impact on x86 builds, period.

So I'm sorry, but I'm calling bullshit. Something's quite wrong with
the bot - either its build system or the bisection process.

2019-11-30 11:17:19

by Duncan Roe

[permalink] [raw]
Subject: Re: KASAN: use-after-free Read in blkdev_get

On Sun, Nov 24, 2019 at 07:30:35PM +0000, Al Viro wrote:
> On Sun, Nov 24, 2019 at 11:07:00AM -0800, syzbot wrote:
> > syzbot has bisected this bug to:
> >
> > commit 77ef8f5177599efd0cedeb52c1950c1bd73fa5e3
> > Author: Chris Metcalf <[email protected]>
> > Date: Mon Jan 25 20:05:34 2016 +0000
> >
> > tile kgdb: fix bug in copy to gdb regs, and optimize memset
> >
> > bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=1131bc0ee00000
> > start commit: f5b7769e Revert "debugfs: inode: debugfs_create_dir uses m..
> > git tree: upstream
> > final crash: https://syzkaller.appspot.com/x/report.txt?x=1331bc0ee00000
> > console output: https://syzkaller.appspot.com/x/log.txt?x=1531bc0ee00000
> > kernel config: https://syzkaller.appspot.com/x/.config?x=709f8187af941e84
> > dashboard link: https://syzkaller.appspot.com/bug?extid=eaeb616d85c9a0afec7d
> > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=177f898f800000
> > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=147eb85f800000
> >
> > Reported-by: [email protected]
> > Fixes: 77ef8f517759 ("tile kgdb: fix bug in copy to gdb regs, and optimize
> > memset")
> >
> > For information about bisection process see: https://goo.gl/tpsmEJ#bisection
>
> Seriously? How can the commit in question (limited to arch/tile/kernel/kgdb.c)
> possibly affect a bug that manages to produce a crash report with
> RSP: 0018:ffffffff82e03eb8 EFLAGS: 00000282
> RAX: 0000000000000000 RBX: ffffffff82e00000 RCX: 0000000000000000
> RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffff81088779
> RBP: ffffffff82e03eb8 R08: 0000000000000000 R09: 0000000000000001
> R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
> R13: 0000000000000000 R14: 0000000000000000 R15: ffffffff82e00000
> FS: 0000000000000000(0000) GS:ffff88021fc00000(0000) knlGS:0000000000000000
> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 000000c420447ff8 CR3: 0000000213184000 CR4: 00000000001406f0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> in it? Unless something very odd has happened to tile, this crash has
> been observed on 64bit x86; the names of registers alone are enough
> to be certain of that.
>
> And the binaries produced by an x86 build should not be affected by any
> changes in arch/tile; not unless something is very wrong with the build
> system. It's not even that this commit has fixed an earlier bug that
> used to mask the one manifested here - it really should have had zero
> impact on x86 builds, period.
>
> So I'm sorry, but I'm calling bullshit. Something's quite wrong with
> the bot - either its build system or the bisection process.

The acid test would be: does reverting that commit make the problem go away?

See, for example, https://bugzilla.kernel.org/show_bug.cgi?id=203935

Cheers ... Duncan.

2019-11-30 15:54:52

by Dmitry Vyukov

[permalink] [raw]
Subject: Re: KASAN: use-after-free Read in blkdev_get

On Sat, Nov 30, 2019 at 12:06 PM Duncan Roe <[email protected]> wrote:
> > > syzbot has bisected this bug to:
> > >
> > > commit 77ef8f5177599efd0cedeb52c1950c1bd73fa5e3
> > > Author: Chris Metcalf <[email protected]>
> > > Date: Mon Jan 25 20:05:34 2016 +0000
> > >
> > > tile kgdb: fix bug in copy to gdb regs, and optimize memset
> > >
> > > bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=1131bc0ee00000
> > > start commit: f5b7769e Revert "debugfs: inode: debugfs_create_dir uses m..
> > > git tree: upstream
> > > final crash: https://syzkaller.appspot.com/x/report.txt?x=1331bc0ee00000
> > > console output: https://syzkaller.appspot.com/x/log.txt?x=1531bc0ee00000
> > > kernel config: https://syzkaller.appspot.com/x/.config?x=709f8187af941e84
> > > dashboard link: https://syzkaller.appspot.com/bug?extid=eaeb616d85c9a0afec7d
> > > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=177f898f800000
> > > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=147eb85f800000
> > >
> > > Reported-by: [email protected]
> > > Fixes: 77ef8f517759 ("tile kgdb: fix bug in copy to gdb regs, and optimize
> > > memset")
> > >
> > > For information about bisection process see: https://goo.gl/tpsmEJ#bisection
> >
> > Seriously? How can the commit in question (limited to arch/tile/kernel/kgdb.c)
> > possibly affect a bug that manages to produce a crash report with
> > RSP: 0018:ffffffff82e03eb8 EFLAGS: 00000282
> > RAX: 0000000000000000 RBX: ffffffff82e00000 RCX: 0000000000000000
> > RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffff81088779
> > RBP: ffffffff82e03eb8 R08: 0000000000000000 R09: 0000000000000001
> > R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
> > R13: 0000000000000000 R14: 0000000000000000 R15: ffffffff82e00000
> > FS: 0000000000000000(0000) GS:ffff88021fc00000(0000) knlGS:0000000000000000
> > CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> > CR2: 000000c420447ff8 CR3: 0000000213184000 CR4: 00000000001406f0
> > DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> > DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> > in it? Unless something very odd has happened to tile, this crash has
> > been observed on 64bit x86; the names of registers alone are enough
> > to be certain of that.
> >
> > And the binaries produced by an x86 build should not be affected by any
> > changes in arch/tile; not unless something is very wrong with the build
> > system. It's not even that this commit has fixed an earlier bug that
> > used to mask the one manifested here - it really should have had zero
> > impact on x86 builds, period.
> >
> > So I'm sorry, but I'm calling bullshit. Something's quite wrong with
> > the bot - either its build system or the bisection process.
>
> The acid test would be: does reverting that commit make the problem go away?
>
> See, for example, https://bugzilla.kernel.org/show_bug.cgi?id=203935
>
> Cheers ... Duncan.

This is done as part of any bisection by definition, right? The test
was done on the previous commit (effectively this one reverted) and no
crash was observed. Otherwise bisection would have been pointed to a
different commit.

2019-12-01 00:07:58

by Duncan Roe

[permalink] [raw]
Subject: Re: KASAN: use-after-free Read in blkdev_get

On Sat, Nov 30, 2019 at 04:53:12PM +0100, Dmitry Vyukov wrote:
> On Sat, Nov 30, 2019 at 12:06 PM Duncan Roe <[email protected]> wrote:
> > > > syzbot has bisected this bug to:
> > > >
> > > > commit 77ef8f5177599efd0cedeb52c1950c1bd73fa5e3
> > > > Author: Chris Metcalf <[email protected]>
> > > > Date: Mon Jan 25 20:05:34 2016 +0000
> > > >
> > > > tile kgdb: fix bug in copy to gdb regs, and optimize memset
> > > >
> > > > bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=1131bc0ee00000
> > > > start commit: f5b7769e Revert "debugfs: inode: debugfs_create_dir uses m..
> > > > git tree: upstream
> > > > final crash: https://syzkaller.appspot.com/x/report.txt?x=1331bc0ee00000
> > > > console output: https://syzkaller.appspot.com/x/log.txt?x=1531bc0ee00000
> > > > kernel config: https://syzkaller.appspot.com/x/.config?x=709f8187af941e84
> > > > dashboard link: https://syzkaller.appspot.com/bug?extid=eaeb616d85c9a0afec7d
> > > > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=177f898f800000
> > > > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=147eb85f800000
> > > >
> > > > Reported-by: [email protected]
> > > > Fixes: 77ef8f517759 ("tile kgdb: fix bug in copy to gdb regs, and optimize
> > > > memset")
> > > >
> > > > For information about bisection process see: https://goo.gl/tpsmEJ#bisection
> > >
> > > Seriously? How can the commit in question (limited to arch/tile/kernel/kgdb.c)
> > > possibly affect a bug that manages to produce a crash report with
> > > RSP: 0018:ffffffff82e03eb8 EFLAGS: 00000282
> > > RAX: 0000000000000000 RBX: ffffffff82e00000 RCX: 0000000000000000
> > > RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffff81088779
> > > RBP: ffffffff82e03eb8 R08: 0000000000000000 R09: 0000000000000001
> > > R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
> > > R13: 0000000000000000 R14: 0000000000000000 R15: ffffffff82e00000
> > > FS: 0000000000000000(0000) GS:ffff88021fc00000(0000) knlGS:0000000000000000
> > > CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> > > CR2: 000000c420447ff8 CR3: 0000000213184000 CR4: 00000000001406f0
> > > DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> > > DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> > > in it? Unless something very odd has happened to tile, this crash has
> > > been observed on 64bit x86; the names of registers alone are enough
> > > to be certain of that.
> > >
> > > And the binaries produced by an x86 build should not be affected by any
> > > changes in arch/tile; not unless something is very wrong with the build
> > > system. It's not even that this commit has fixed an earlier bug that
> > > used to mask the one manifested here - it really should have had zero
> > > impact on x86 builds, period.
> > >
> > > So I'm sorry, but I'm calling bullshit. Something's quite wrong with
> > > the bot - either its build system or the bisection process.
> >
> > The acid test would be: does reverting that commit make the problem go away?
> >
> > See, for example, https://bugzilla.kernel.org/show_bug.cgi?id=203935
> >
> > Cheers ... Duncan.
>
> This is done as part of any bisection by definition, right? The test
> was done on the previous commit (effectively this one reverted) and no
> crash was observed. Otherwise bisection would have been pointed to a
> different commit.
>
Agree that's what bisecting does. What I had in mind was to make a patch to
remove the identified commit, and apply that to the most recent revision
possible. Then see if that makes the problem go away.

However when I look at my clone of
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git and compare
77ef8f5177 with the previous commit a7d1357664, "git diff --stat" shows

> 745 files changed, 8192 insertions(+), 15408 deletions(-)

The last few lines from a grep of "arch" are:

> arch/s390/oprofile/backtrace.c | 8 +-
> arch/tile/kernel/kgdb.c | 8 +-
> arch/x86/Kconfig | 5 +-
> arch/x86/include/asm/livepatch.h | 2 +-
> arch/x86/include/asm/processor.h | 2 +-
> arch/x86/kernel/cpu/perf_event_amd_uncore.c | 2 +
> arch/x86/lib/copy_user_64.S | 142 ++-
> arch/x86/mm/fault.c | 15 +-
> arch/x86/mm/gup.c | 2 +-
> arch/x86/mm/numa.c | 2 +-

Enough said?

Cheers ... Duncan.

2019-12-02 06:48:53

by Dmitry Vyukov

[permalink] [raw]
Subject: Re: KASAN: use-after-free Read in blkdev_get

On Sun, Dec 1, 2019 at 1:04 AM Duncan Roe <[email protected]> wrote:
>
> On Sat, Nov 30, 2019 at 04:53:12PM +0100, Dmitry Vyukov wrote:
> > On Sat, Nov 30, 2019 at 12:06 PM Duncan Roe <[email protected]> wrote:
> > > > > syzbot has bisected this bug to:
> > > > >
> > > > > commit 77ef8f5177599efd0cedeb52c1950c1bd73fa5e3
> > > > > Author: Chris Metcalf <[email protected]>
> > > > > Date: Mon Jan 25 20:05:34 2016 +0000
> > > > >
> > > > > tile kgdb: fix bug in copy to gdb regs, and optimize memset
> > > > >
> > > > > bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=1131bc0ee00000
> > > > > start commit: f5b7769e Revert "debugfs: inode: debugfs_create_dir uses m..
> > > > > git tree: upstream
> > > > > final crash: https://syzkaller.appspot.com/x/report.txt?x=1331bc0ee00000
> > > > > console output: https://syzkaller.appspot.com/x/log.txt?x=1531bc0ee00000
> > > > > kernel config: https://syzkaller.appspot.com/x/.config?x=709f8187af941e84
> > > > > dashboard link: https://syzkaller.appspot.com/bug?extid=eaeb616d85c9a0afec7d
> > > > > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=177f898f800000
> > > > > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=147eb85f800000
> > > > >
> > > > > Reported-by: [email protected]
> > > > > Fixes: 77ef8f517759 ("tile kgdb: fix bug in copy to gdb regs, and optimize
> > > > > memset")
> > > > >
> > > > > For information about bisection process see: https://goo.gl/tpsmEJ#bisection
> > > >
> > > > Seriously? How can the commit in question (limited to arch/tile/kernel/kgdb.c)
> > > > possibly affect a bug that manages to produce a crash report with
> > > > RSP: 0018:ffffffff82e03eb8 EFLAGS: 00000282
> > > > RAX: 0000000000000000 RBX: ffffffff82e00000 RCX: 0000000000000000
> > > > RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffff81088779
> > > > RBP: ffffffff82e03eb8 R08: 0000000000000000 R09: 0000000000000001
> > > > R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
> > > > R13: 0000000000000000 R14: 0000000000000000 R15: ffffffff82e00000
> > > > FS: 0000000000000000(0000) GS:ffff88021fc00000(0000) knlGS:0000000000000000
> > > > CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> > > > CR2: 000000c420447ff8 CR3: 0000000213184000 CR4: 00000000001406f0
> > > > DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> > > > DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> > > > in it? Unless something very odd has happened to tile, this crash has
> > > > been observed on 64bit x86; the names of registers alone are enough
> > > > to be certain of that.
> > > >
> > > > And the binaries produced by an x86 build should not be affected by any
> > > > changes in arch/tile; not unless something is very wrong with the build
> > > > system. It's not even that this commit has fixed an earlier bug that
> > > > used to mask the one manifested here - it really should have had zero
> > > > impact on x86 builds, period.
> > > >
> > > > So I'm sorry, but I'm calling bullshit. Something's quite wrong with
> > > > the bot - either its build system or the bisection process.
> > >
> > > The acid test would be: does reverting that commit make the problem go away?
> > >
> > > See, for example, https://bugzilla.kernel.org/show_bug.cgi?id=203935
> > >
> > > Cheers ... Duncan.
> >
> > This is done as part of any bisection by definition, right? The test
> > was done on the previous commit (effectively this one reverted) and no
> > crash was observed. Otherwise bisection would have been pointed to a
> > different commit.
> >
> Agree that's what bisecting does. What I had in mind was to make a patch to
> remove the identified commit, and apply that to the most recent revision
> possible. Then see if that makes the problem go away.

I wonder in what percent of cases:
1. It gives signal different from reverting the commit in place.
2. The revert can be cleanly applied to head.
3. The revert does not introduce other bugs.

For this to be worth doing, all these 3 should be reasonably high. I
can imagine 3 may be high (?), but I am not sure about 1 and 2.

2019-12-02 09:36:11

by Duncan Roe

[permalink] [raw]
Subject: Re: KASAN: use-after-free Read in blkdev_get

On Mon, Dec 02, 2019 at 07:47:11AM +0100, Dmitry Vyukov wrote:
> On Sun, Dec 1, 2019 at 1:04 AM Duncan Roe <[email protected]> wrote:
> >
> > On Sat, Nov 30, 2019 at 04:53:12PM +0100, Dmitry Vyukov wrote:
> > > On Sat, Nov 30, 2019 at 12:06 PM Duncan Roe <[email protected]> wrote:
> > > > > > syzbot has bisected this bug to:
> > > > > >
> > > > > > commit 77ef8f5177599efd0cedeb52c1950c1bd73fa5e3
> > > > > > Author: Chris Metcalf <[email protected]>
> > > > > > Date: Mon Jan 25 20:05:34 2016 +0000
> > > > > >
> > > > > > tile kgdb: fix bug in copy to gdb regs, and optimize memset
> > > > > >
> > > > > > bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=1131bc0ee00000
> > > > > > start commit: f5b7769e Revert "debugfs: inode: debugfs_create_dir uses m..
> > > > > > git tree: upstream
> > > > > > final crash: https://syzkaller.appspot.com/x/report.txt?x=1331bc0ee00000
> > > > > > console output: https://syzkaller.appspot.com/x/log.txt?x=1531bc0ee00000
> > > > > > kernel config: https://syzkaller.appspot.com/x/.config?x=709f8187af941e84
> > > > > > dashboard link: https://syzkaller.appspot.com/bug?extid=eaeb616d85c9a0afec7d
> > > > > > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=177f898f800000
> > > > > > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=147eb85f800000
> > > > > >
> > > > > > Reported-by: [email protected]
> > > > > > Fixes: 77ef8f517759 ("tile kgdb: fix bug in copy to gdb regs, and optimize
> > > > > > memset")
> > > > > >
> > > > > > For information about bisection process see: https://goo.gl/tpsmEJ#bisection
> > > > >
> > > > > Seriously? How can the commit in question (limited to arch/tile/kernel/kgdb.c)
> > > > > possibly affect a bug that manages to produce a crash report with
> > > > > RSP: 0018:ffffffff82e03eb8 EFLAGS: 00000282
> > > > > RAX: 0000000000000000 RBX: ffffffff82e00000 RCX: 0000000000000000
> > > > > RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffff81088779
> > > > > RBP: ffffffff82e03eb8 R08: 0000000000000000 R09: 0000000000000001
> > > > > R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
> > > > > R13: 0000000000000000 R14: 0000000000000000 R15: ffffffff82e00000
> > > > > FS: 0000000000000000(0000) GS:ffff88021fc00000(0000) knlGS:0000000000000000
> > > > > CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> > > > > CR2: 000000c420447ff8 CR3: 0000000213184000 CR4: 00000000001406f0
> > > > > DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> > > > > DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> > > > > in it? Unless something very odd has happened to tile, this crash has
> > > > > been observed on 64bit x86; the names of registers alone are enough
> > > > > to be certain of that.
> > > > >
> > > > > And the binaries produced by an x86 build should not be affected by any
> > > > > changes in arch/tile; not unless something is very wrong with the build
> > > > > system. It's not even that this commit has fixed an earlier bug that
> > > > > used to mask the one manifested here - it really should have had zero
> > > > > impact on x86 builds, period.
> > > > >
> > > > > So I'm sorry, but I'm calling bullshit. Something's quite wrong with
> > > > > the bot - either its build system or the bisection process.
> > > >
> > > > The acid test would be: does reverting that commit make the problem go away?
> > > >
> > > > See, for example, https://bugzilla.kernel.org/show_bug.cgi?id=203935
> > > >
> > > > Cheers ... Duncan.
> > >
> > > This is done as part of any bisection by definition, right? The test
> > > was done on the previous commit (effectively this one reverted) and no
> > > crash was observed. Otherwise bisection would have been pointed to a
> > > different commit.
> > >
> > Agree that's what bisecting does. What I had in mind was to make a patch to
> > remove the identified commit, and apply that to the most recent revision
> > possible. Then see if that makes the problem go away.
>
> I wonder in what percent of cases:
> 1. It gives signal different from reverting the commit in place.
> 2. The revert can be cleanly applied to head.
> 3. The revert does not introduce other bugs.
>
> For this to be worth doing, all these 3 should be reasonably high. I
> can imagine 3 may be high (?), but I am not sure about 1 and 2.

The whole arch/tile directory no longer exists, so the patch cannot be applied.
If I had realised that earlier, I would not have posted at all.
Sorry for the noise.