syzbot


KASAN: use-after-free Write in get_block

Status: upstream: reported C repro on 2020/04/12 23:36
Reported-by: syzbot+7e141a7bc0e3beee9d49@syzkaller.appspotmail.com
First crash: 1696d, last: 1648d
Fix bisection the fix commit could be any of (bisect log):
  773e2b1cd56a Linux 4.14.178
  4139fb08c05f Linux 4.14.187
  
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Write in get_block fs C inconclusive inconclusive 12 1622d 1672d 15/28 fixed on 2020/09/16 22:51
linux-4.19 KASAN: use-after-free Write in get_block 3 1674d 1693d 0/1 auto-closed as invalid on 2020/09/02 00:35
Last patch testing requests (6)
Created Duration User Patch Repo Result
2023/01/15 16:32 14m retest repro linux-4.14.y report log
2023/01/15 08:32 13m retest repro linux-4.14.y report log
2023/01/15 07:32 9m retest repro linux-4.14.y report log
2022/09/03 11:27 10m retest repro linux-4.14.y report log
2022/09/03 10:27 13m retest repro linux-4.14.y report log
2022/09/03 09:27 10m retest repro linux-4.14.y report log

Sample crash report:
MINIX-fs: mounting unchecked file system, running fsck is recommended
Process accounting resumed
syz-executor085 (6330) used greatest stack depth: 25440 bytes left
Process accounting resumed
==================================================================
BUG: KASAN: use-after-free in alloc_branch fs/minix/itree_common.c:92 [inline]
BUG: KASAN: use-after-free in get_block+0xfaa/0x10f0 fs/minix/itree_common.c:191
Write of size 2 at addr ffff8880836b67b8 by task syz-executor085/6558

CPU: 1 PID: 6558 Comm: syz-executor085 Not tainted 4.14.178-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x13e/0x194 lib/dump_stack.c:58
 print_address_description.cold+0x7c/0x1e2 mm/kasan/report.c:252
 kasan_report_error mm/kasan/report.c:351 [inline]
 kasan_report mm/kasan/report.c:409 [inline]
 kasan_report.cold+0xa9/0x2ae mm/kasan/report.c:393
 alloc_branch fs/minix/itree_common.c:92 [inline]
 get_block+0xfaa/0x10f0 fs/minix/itree_common.c:191
 minix_get_block+0xd6/0x100 fs/minix/inode.c:379
 __block_write_begin_int+0x337/0x1030 fs/buffer.c:2038
 __block_write_begin fs/buffer.c:2088 [inline]
 block_write_begin+0x58/0x260 fs/buffer.c:2147
 minix_write_begin+0x35/0xc0 fs/minix/inode.c:415
 generic_perform_write+0x1c9/0x420 mm/filemap.c:3047
 __generic_file_write_iter+0x227/0x590 mm/filemap.c:3172
 generic_file_write_iter+0x2fa/0x650 mm/filemap.c:3200
 call_write_iter include/linux/fs.h:1778 [inline]
 new_sync_write fs/read_write.c:469 [inline]
 __vfs_write+0x44e/0x630 fs/read_write.c:482
 __kernel_write+0xf5/0x330 fs/read_write.c:501
 do_acct_process+0xb49/0xf60 kernel/acct.c:520
 acct_pin_kill+0x28/0xe0 kernel/acct.c:174
 pin_kill+0x147/0x650 fs/fs_pin.c:50
 mnt_pin_kill+0x62/0x170 fs/fs_pin.c:87
 cleanup_mnt+0x110/0x140 fs/namespace.c:1180
 task_work_run+0x113/0x190 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0x9f2/0x2b00 kernel/exit.c:858
 do_group_exit+0x100/0x310 kernel/exit.c:955
 get_signal+0x385/0x1ca0 kernel/signal.c:2423
 do_signal+0x7c/0x1690 arch/x86/kernel/signal.c:814
 exit_to_usermode_loop+0x159/0x220 arch/x86/entry/common.c:160
 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:270 [inline]
 do_syscall_64+0x4a3/0x640 arch/x86/entry/common.c:297
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x44d1b9
RSP: 002b:00007feaf5b29cf8 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca
RAX: fffffffffffffe00 RBX: 00000000006dfc28 RCX: 000000000044d1b9
RDX: 0000000000000000 RSI: 0000000000000080 RDI: 00000000006dfc28
RBP: 00000000006dfc20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006dfc2c
R13: 00007fff7a4a0acf R14: 00007feaf5b2a9c0 R15: 00000000006dfc2c

The buggy address belongs to the page:
page:ffffea00020dad80 count:0 mapcount:0 mapping:          (null) index:0x1
flags: 0xfffe0000000000()
raw: 00fffe0000000000 0000000000000000 0000000000000001 00000000ffffffff
raw: ffffea00020f88a0 ffffea00022c86a0 0000000000000000 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880836b6680: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff8880836b6700: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff8880836b6780: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                                        ^
 ffff8880836b6800: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff8880836b6880: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (5):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/05/05 01:22 linux-4.14.y 773e2b1cd56a 9941337c .config console log report syz C ci2-linux-4-14
2020/05/03 14:55 linux-4.14.y 773e2b1cd56a 58ae5e18 .config console log report syz C ci2-linux-4-14
2020/05/03 00:20 linux-4.14.y 773e2b1cd56a 5457883a .config console log report syz C ci2-linux-4-14
2020/05/31 00:31 linux-4.14.y 4f68020fef1c 6f3e1c7c .config console log report ci2-linux-4-14
2020/04/12 23:35 linux-4.14.y 4520f06b03ae 36b0b050 .config console log report ci2-linux-4-14
* Struck through repros no longer work on HEAD.