syzbot


KASAN: use-after-free Read in sysv_new_block

Status: upstream: reported C repro on 2022/11/30 03:11
Subsystems: sysv
[Documentation on labels]
Reported-by: syzbot+820856e34e86e5399d8a@syzkaller.appspotmail.com
First crash: 733d, last: 703d
Fix bisection: failed (error log, bisect log)
  
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in sysv_new_block fs C error done 242 19h24m 731d 0/28 upstream: reported C repro on 2022/12/01 12:49
linux-6.1 KASAN: use-after-free Read in sysv_new_block 6 5h10m 34d 0/3 upstream: reported on 2024/10/28 12:55
linux-5.15 KASAN: use-after-free Read in sysv_new_block origin:upstream C 12 5d21h 43d 0/3 upstream: reported C repro on 2024/10/20 05:31
linux-4.14 KASAN: use-after-free Read in sysv_new_block C 1 641d 725d 0/1 upstream: reported C repro on 2022/12/08 01:50

Sample crash report:
sysv_free_block: flc_count > flc_size
sysv_free_block: flc_count > flc_size
sysv_free_block: flc_count > flc_size
sysv_free_block: flc_count > flc_size
==================================================================
BUG: KASAN: use-after-free in sysv_new_block+0x79f/0x990 fs/sysv/balloc.c:113
Read of size 4 at addr ffff88808c01d0c8 by task syz-executor420/8100

CPU: 1 PID: 8100 Comm: syz-executor420 Not tainted 4.19.211-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1fc/0x2ef lib/dump_stack.c:118
 print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
 kasan_report_error.cold+0x8a/0x1b9 mm/kasan/report.c:354
 kasan_report mm/kasan/report.c:412 [inline]
 __asan_report_load4_noabort+0x88/0x90 mm/kasan/report.c:432
 sysv_new_block+0x79f/0x990 fs/sysv/balloc.c:113
 alloc_branch fs/sysv/itree.c:134 [inline]
 get_block+0x3fa/0x1510 fs/sysv/itree.c:251
 __block_write_begin_int+0x46c/0x17b0 fs/buffer.c:1978
 __block_write_begin fs/buffer.c:2028 [inline]
 block_write_begin+0x58/0x2e0 fs/buffer.c:2087
 sysv_write_begin+0x35/0xe0 fs/sysv/itree.c:485
 generic_perform_write+0x1f8/0x4d0 mm/filemap.c:3170
 __generic_file_write_iter+0x24b/0x610 mm/filemap.c:3295
 generic_file_write_iter+0x3f8/0x730 mm/filemap.c:3323
 call_write_iter include/linux/fs.h:1821 [inline]
 new_sync_write fs/read_write.c:474 [inline]
 __vfs_write+0x51b/0x770 fs/read_write.c:487
 vfs_write+0x1f3/0x540 fs/read_write.c:549
 ksys_write+0x12b/0x2a0 fs/read_write.c:599
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7f605e78c6a9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 14 00 00 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 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffd68472268 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007ffd684722a8 RCX: 00007f605e78c6a9
RDX: 00000000fffffd5e RSI: 000000002000ad00 RDI: 0000000000000004
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffd684722a0
R13: 0000000000000000 R14: 431bde82d7b634db R15: 0000000000000000

The buggy address belongs to the page:
page:ffffea0002300740 count:0 mapcount:0 mapping:0000000000000000 index:0x0
flags: 0xfff00000000000()
raw: 00fff00000000000 0000000000000000 ffffea0002300748 0000000000000000
raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88808c01cf80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88808c01d000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff88808c01d080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                                              ^
 ffff88808c01d100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88808c01d180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/12/01 16:34 linux-4.19.y 3f8a27f9e27b 4c2a66e8 .config console log report syz C [disk image] [vmlinux] [mounted in repro] ci2-linux-4-19 KASAN: use-after-free Read in sysv_new_block
2022/11/30 03:11 linux-4.19.y 3f8a27f9e27b 579a3740 .config console log report syz C [disk image] [vmlinux] [mounted in repro] ci2-linux-4-19 KASAN: use-after-free Read in sysv_new_block
2022/12/29 19:03 linux-4.19.y 3f8a27f9e27b 44712fbc .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in sysv_new_block
2022/12/04 02:42 linux-4.19.y 3f8a27f9e27b e080de16 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in sysv_new_block
* Struck through repros no longer work on HEAD.