syzbot


KASAN: use-after-free Read in xlog_alloc_log (2)

Status: fixed on 2020/01/08 01:06
Subsystems: xfs
[Documentation on labels]
Reported-by: syzbot+c732f8644185de340492@syzkaller.appspotmail.com
Fix commit: 798a9cada469 xfs: fix mount failure crash on invalid iclog memory access
First crash: 1688d, last: 1679d
Discussions (7)
Title Replies (including bot) Last reply
[PATCH 4.9 00/91] 4.9.209-stable review 97 (97) 2020/01/13 15:47
[PATCH 4.4 00/59] 4.4.209-stable review 63 (63) 2020/01/13 15:41
[PATCH 4.19 000/115] 4.19.94-stable review 127 (127) 2020/01/08 16:49
[PATCH 4.14 00/74] 4.14.163-stable review 82 (82) 2020/01/08 16:36
[PATCH 5.4 000/191] 5.4.8-stable review 215 (215) 2020/01/06 09:03
KASAN: use-after-free Read in xlog_alloc_log (2) 1 (2) 2019/12/03 13:48
Re: KASAN: use-after-free Read in xlog_alloc_log (2) 1 (1) 2019/12/02 21:16
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in xlog_alloc_log xfs 16 1823d 1843d 12/27 fixed on 2019/08/05 13:45

Sample crash report:
XFS (loop2): Mounting V4 Filesystem
==================================================================
BUG: KASAN: use-after-free in xlog_alloc_log+0x1386/0x14b0 fs/xfs/xfs_log.c:1542
Read of size 8 at addr ffff888097f3e090 by task syz-executor.2/30080

CPU: 1 PID: 30080 Comm: syz-executor.2 Not tainted 5.4.0-syzkaller #0
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+0x197/0x210 lib/dump_stack.c:118
 print_address_description.constprop.0.cold+0xd4/0x30b mm/kasan/report.c:374
 __kasan_report.cold+0x1b/0x41 mm/kasan/report.c:506
 kasan_report+0x12/0x20 mm/kasan/common.c:639
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:135
 xlog_alloc_log+0x1386/0x14b0 fs/xfs/xfs_log.c:1542
 xfs_log_mount+0xdc/0x780 fs/xfs/xfs_log.c:653
 xfs_mountfs+0xc35/0x1ca0 fs/xfs/xfs_mount.c:775
 xfs_fc_fill_super+0x84e/0x11c0 fs/xfs/xfs_super.c:1506
 get_tree_bdev+0x414/0x650 fs/super.c:1340
 xfs_fc_get_tree+0x1d/0x30 fs/xfs/xfs_super.c:1550
 vfs_get_tree+0x8e/0x300 fs/super.c:1545
 do_new_mount fs/namespace.c:2822 [inline]
 do_mount+0x135a/0x1b50 fs/namespace.c:3142
 ksys_mount+0xdb/0x150 fs/namespace.c:3351
 __do_sys_mount fs/namespace.c:3365 [inline]
 __se_sys_mount fs/namespace.c:3362 [inline]
 __x64_sys_mount+0xbe/0x150 fs/namespace.c:3362
 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x45d14a
Code: b8 a6 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 4d 8c 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 2a 8c fb ff c3 66 0f 1f 84 00 00 00 00 00
RSP: 002b:00007f68448f6a88 EFLAGS: 00000206 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007f68448f6b40 RCX: 000000000045d14a
RDX: 00007f68448f6ae0 RSI: 0000000020000100 RDI: 00007f68448f6b00
RBP: 0000000000000001 R08: 00007f68448f6b40 R09: 00007f68448f6ae0
R10: 0000000000000000 R11: 0000000000000206 R12: 0000000000000003
R13: 00000000004cac74 R14: 00000000004e4190 R15: 00000000ffffffff

Allocated by task 30080:
 save_stack+0x23/0x90 mm/kasan/common.c:72
 set_track mm/kasan/common.c:80 [inline]
 __kasan_kmalloc mm/kasan/common.c:513 [inline]
 __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:486
 kasan_kmalloc+0x9/0x10 mm/kasan/common.c:527
 __do_kmalloc mm/slab.c:3656 [inline]
 __kmalloc+0x163/0x770 mm/slab.c:3665
 kmalloc include/linux/slab.h:561 [inline]
 kmem_alloc+0x15b/0x4d0 fs/xfs/kmem.c:21
 kmem_zalloc fs/xfs/kmem.h:68 [inline]
 xlog_alloc_log+0xcc3/0x14b0 fs/xfs/xfs_log.c:1484
 xfs_log_mount+0xdc/0x780 fs/xfs/xfs_log.c:653
 xfs_mountfs+0xc35/0x1ca0 fs/xfs/xfs_mount.c:775
 xfs_fc_fill_super+0x84e/0x11c0 fs/xfs/xfs_super.c:1506
 get_tree_bdev+0x414/0x650 fs/super.c:1340
 xfs_fc_get_tree+0x1d/0x30 fs/xfs/xfs_super.c:1550
 vfs_get_tree+0x8e/0x300 fs/super.c:1545
 do_new_mount fs/namespace.c:2822 [inline]
 do_mount+0x135a/0x1b50 fs/namespace.c:3142
 ksys_mount+0xdb/0x150 fs/namespace.c:3351
 __do_sys_mount fs/namespace.c:3365 [inline]
 __se_sys_mount fs/namespace.c:3362 [inline]
 __x64_sys_mount+0xbe/0x150 fs/namespace.c:3362
 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 30080:
 save_stack+0x23/0x90 mm/kasan/common.c:72
 set_track mm/kasan/common.c:80 [inline]
 kasan_set_free_info mm/kasan/common.c:335 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/common.c:474
 kasan_slab_free+0xe/0x10 mm/kasan/common.c:483
 __cache_free mm/slab.c:3426 [inline]
 kfree+0x10a/0x2c0 mm/slab.c:3757
 kvfree+0x61/0x70 mm/util.c:603
 kmem_free fs/xfs/kmem.h:61 [inline]
 xlog_alloc_log+0xeaa/0x14b0 fs/xfs/xfs_log.c:1544
 xfs_log_mount+0xdc/0x780 fs/xfs/xfs_log.c:653
 xfs_mountfs+0xc35/0x1ca0 fs/xfs/xfs_mount.c:775
 xfs_fc_fill_super+0x84e/0x11c0 fs/xfs/xfs_super.c:1506
 get_tree_bdev+0x414/0x650 fs/super.c:1340
 xfs_fc_get_tree+0x1d/0x30 fs/xfs/xfs_super.c:1550
 vfs_get_tree+0x8e/0x300 fs/super.c:1545
 do_new_mount fs/namespace.c:2822 [inline]
 do_mount+0x135a/0x1b50 fs/namespace.c:3142
 ksys_mount+0xdb/0x150 fs/namespace.c:3351
 __do_sys_mount fs/namespace.c:3365 [inline]
 __se_sys_mount fs/namespace.c:3362 [inline]
 __x64_sys_mount+0xbe/0x150 fs/namespace.c:3362
 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff888097f3e000
 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 144 bytes inside of
 1024-byte region [ffff888097f3e000, ffff888097f3e400)
The buggy address belongs to the page:
page:ffffea00025fcf80 refcount:1 mapcount:0 mapping:ffff8880aa400c40 index:0x0
raw: 00fffe0000000200 ffffea0001f28c48 ffffea00025fcfc8 ffff8880aa400c40
raw: 0000000000000000 ffff888097f3e000 0000000100000002 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888097f3df80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888097f3e000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888097f3e080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                         ^
 ffff888097f3e100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888097f3e180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (55):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/12/07 20:54 upstream ad910e36da4c 1508f453 .config console log report ci-upstream-kasan-gce-selinux-root
2019/12/07 13:20 upstream eea2d5da29e3 85f26751 .config console log report ci-upstream-kasan-gce-selinux-root
2019/12/07 07:11 upstream 7ada90eb9c7a 85f26751 .config console log report ci-upstream-kasan-gce-selinux-root
2019/12/06 17:32 upstream b0d4beaa5a4b 85f26751 .config console log report ci-upstream-kasan-gce-root
2019/12/06 07:00 upstream b0d4beaa5a4b 98b4ef2d .config console log report ci-upstream-kasan-gce-root
2019/12/04 10:57 upstream 63de37476ebd 0ecb9746 .config console log report ci-upstream-kasan-gce-root
2019/12/04 05:56 upstream 76bb8b05960c ae13a849 .config console log report ci-upstream-kasan-gce-selinux-root
2019/12/04 04:13 upstream 76bb8b05960c ae13a849 .config console log report ci-upstream-kasan-gce-selinux-root
2019/12/03 21:24 upstream 76bb8b05960c ae13a849 .config console log report ci-upstream-kasan-gce-root
2019/12/03 21:13 upstream 76bb8b05960c ae13a849 .config console log report ci-upstream-kasan-gce-selinux-root
2019/12/03 20:57 upstream 76bb8b05960c ae13a849 .config console log report ci-upstream-kasan-gce-selinux-root
2019/12/03 20:41 upstream 76bb8b05960c ae13a849 .config console log report ci-upstream-kasan-gce-selinux-root
2019/12/03 18:07 upstream 76bb8b05960c ae13a849 .config console log report ci-upstream-kasan-gce-selinux-root
2019/12/03 10:26 upstream 596cf45cbf6e ab342da3 .config console log report ci-upstream-kasan-gce-root
2019/12/03 05:06 upstream 596cf45cbf6e ab342da3 .config console log report ci-upstream-kasan-gce-root
2019/12/02 21:38 upstream 596cf45cbf6e ab342da3 .config console log report ci-upstream-kasan-gce-selinux-root
2019/12/02 06:44 upstream ceb307474506 f879db37 .config console log report ci-upstream-kasan-gce-smack-root
2019/12/02 00:37 upstream b94ae8ad9fe7 f879db37 .config console log report ci-upstream-kasan-gce-selinux-root
2019/12/01 19:11 upstream b94ae8ad9fe7 f879db37 .config console log report ci-qemu-upstream
2019/12/01 15:11 upstream b94ae8ad9fe7 a76bf83f .config console log report ci-upstream-kasan-gce-smack-root
2019/12/01 01:20 upstream 32ef9553635a a76bf83f .config console log report ci-upstream-kasan-gce-smack-root
2019/11/30 19:00 upstream 81b6b96475ac 3a75be00 .config console log report ci-upstream-kasan-gce-smack-root
2019/11/30 15:46 upstream 81b6b96475ac 3a75be00 .config console log report ci-qemu-upstream
2019/11/30 05:07 upstream 81b6b96475ac 3a75be00 .config console log report ci-upstream-kasan-gce-selinux-root
2019/11/30 04:54 upstream 81b6b96475ac 3a75be00 .config console log report ci-upstream-kasan-gce-root
2019/11/30 04:14 upstream 81b6b96475ac 3a75be00 .config console log report ci-upstream-kasan-gce-root
2019/11/30 04:14 upstream 81b6b96475ac 3a75be00 .config console log report ci-upstream-kasan-gce-root
2019/11/30 03:18 upstream 81b6b96475ac 3a75be00 .config console log report ci-qemu-upstream
2019/11/30 03:18 upstream 81b6b96475ac 3a75be00 .config console log report ci-upstream-kasan-gce-root
2019/11/30 03:03 upstream 81b6b96475ac 3a75be00 .config console log report ci-upstream-kasan-gce-selinux-root
2019/11/30 00:43 upstream 81b6b96475ac 3a75be00 .config console log report ci-upstream-kasan-gce-smack-root
2019/11/29 23:19 upstream 81b6b96475ac d29b9e84 .config console log report ci-upstream-kasan-gce-root
2019/11/29 19:25 upstream 81b6b96475ac d29b9e84 .config console log report ci-upstream-kasan-gce-selinux-root
2019/11/29 18:57 upstream 81b6b96475ac d29b9e84 .config console log report ci-upstream-kasan-gce-smack-root
2019/11/29 18:56 upstream 81b6b96475ac d29b9e84 .config console log report ci-upstream-kasan-gce-selinux-root
2019/11/29 18:14 upstream 81b6b96475ac d29b9e84 .config console log report ci-upstream-kasan-gce-selinux-root
2019/11/29 17:44 upstream 81b6b96475ac d29b9e84 .config console log report ci-upstream-kasan-gce-smack-root
2019/11/29 17:44 upstream 81b6b96475ac d29b9e84 .config console log report ci-upstream-kasan-gce-selinux-root
2019/11/29 17:32 upstream 81b6b96475ac d29b9e84 .config console log report ci-upstream-kasan-gce-smack-root
2019/11/29 17:15 upstream 81b6b96475ac d29b9e84 .config console log report ci-upstream-kasan-gce-selinux-root
2019/12/04 14:10 linux-next c7c32c43e831 b2088328 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/12/04 09:16 linux-next c7c32c43e831 0ecb9746 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/12/03 21:32 linux-next 1ab75b2e415a ae13a849 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/12/02 07:45 linux-next c5db92909bed f879db37 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/12/02 01:55 linux-next 419593dad843 f879db37 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/12/01 01:25 linux-next 419593dad843 a76bf83f .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/30 15:46 linux-next 419593dad843 3a75be00 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/30 07:46 linux-next 419593dad843 3a75be00 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/30 03:54 linux-next 419593dad843 3a75be00 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/29 18:20 linux-next 419593dad843 d29b9e84 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/29 17:25 linux-next 419593dad843 d29b9e84 .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.