syzbot


KASAN: use-after-free Read in dbNextAG

Status: upstream: reported C repro on 2022/09/25 01:19
Subsystems: jfs
[Documentation on labels]
Reported-by: syzbot+d83a549f8d8f79ed75f9@syzkaller.appspotmail.com
First crash: 551d, last: 446d
Fix bisection: failed (error log, bisect log)
  
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: use-after-free Read in dbNextAG C 2 401d 551d 0/1 upstream: reported C repro on 2022/09/25 01:19
upstream UBSAN: array-index-out-of-bounds in dbNextAG jfs C inconclusive inconclusive 52 122d 549d 25/26 fixed on 2023/12/21 01:43

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in atomic_read include/asm-generic/atomic-instrumented.h:21 [inline]
BUG: KASAN: use-after-free in dbNextAG+0x14f/0x530 fs/jfs/jfs_dmap.c:622
Read of size 4 at addr ffff8880970e2658 by task syz-executor891/8101

CPU: 0 PID: 8101 Comm: syz-executor891 Not tainted 4.19.211-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/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+0x8f/0xa0 mm/kasan/report.c:412
 atomic_read include/asm-generic/atomic-instrumented.h:21 [inline]
 dbNextAG+0x14f/0x530 fs/jfs/jfs_dmap.c:622
 diAlloc+0x7ea/0x1440 fs/jfs/jfs_imap.c:1380
 ialloc+0x8c/0x970 fs/jfs/jfs_inode.c:69
 jfs_mkdir.part.0+0x131/0x870 fs/jfs/namei.c:237
 jfs_mkdir+0x3f/0x60 fs/jfs/namei.c:222
 vfs_mkdir+0x508/0x7a0 fs/namei.c:3819
 do_mkdirat+0x262/0x2d0 fs/namei.c:3842
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7f4ec4fc0f59
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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:00007ffd6f6e45b8 EFLAGS: 00000246 ORIG_RAX: 0000000000000102
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f4ec4fc0f59
RDX: 00000000000001ff RSI: 0000000020005280 RDI: ffffffffffffff9c
RBP: 00007f4ec4f807c0 R08: 000055555730a2c0 R09: 0000000000000000
R10: 00007ffd6f6e4480 R11: 0000000000000246 R12: 0000000000007366
R13: 0000000000000000 R14: 00080000000000f4 R15: 0000000000000000

Allocated by task 6166:
 kmem_cache_alloc+0x122/0x370 mm/slab.c:3559
 proc_reg_open+0x18c/0x5b0 fs/proc/inode.c:359
 do_dentry_open+0x4aa/0x1160 fs/open.c:796
 do_last fs/namei.c:3421 [inline]
 path_openat+0x793/0x2df0 fs/namei.c:3537
 do_filp_open+0x18c/0x3f0 fs/namei.c:3567
 do_sys_open+0x3b3/0x520 fs/open.c:1085
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 6166:
 __cache_free mm/slab.c:3503 [inline]
 kmem_cache_free+0x7f/0x260 mm/slab.c:3765
 close_pdeo fs/proc/inode.c:401 [inline]
 proc_reg_release+0x21e/0x270 fs/proc/inode.c:395
 __fput+0x2ce/0x890 fs/file_table.c:278
 task_work_run+0x148/0x1c0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:193 [inline]
 exit_to_usermode_loop+0x251/0x2a0 arch/x86/entry/common.c:167
 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
 do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880970e2658
 which belongs to the cache pde_opener of size 40
The buggy address is located 0 bytes inside of
 40-byte region [ffff8880970e2658, ffff8880970e2680)
The buggy address belongs to the page:
page:ffffea00025c3880 count:1 mapcount:0 mapping:ffff88823b843b00 index:0xffff8880970e2fb9
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffffea00028ecb08 ffffea0002672b88 ffff88823b843b00
raw: ffff8880970e2fb9 ffff8880970e2000 0000000100000011 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880970e2500: fc fb fb fb fb fb fc fc fb fb fb fb fb fc fc fb
 ffff8880970e2580: fb fb fb fb fc fc fb fb fb fb fb fc fc fb fb fb
>ffff8880970e2600: fb fb fc fc fb fb fb fb fb fc fc fb fb fb fb fb
                                                    ^
 ffff8880970e2680: fc fc fb fb fb fb fb fc fc fb fb fb fb fb fc fc
 ffff8880970e2700: fb fb fb fb fb fc fc fb fb fb fb fb fc fc fb fb
==================================================================

Crashes (12):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/10/12 23:29 linux-4.19.y 3f8a27f9e27b 16a9c9e0 .config console log report syz C [disk image] [vmlinux] [mounted in repro] ci2-linux-4-19 KASAN: use-after-free Read in dbNextAG
2022/09/25 01:19 linux-4.19.y 3f8a27f9e27b 0042f2b4 .config console log report syz C ci2-linux-4-19 KASAN: use-after-free Read in dbNextAG
2023/01/08 02:34 linux-4.19.y 3f8a27f9e27b 1dac8c7a .config console log report syz C [disk image] [vmlinux] [mounted in repro] ci2-linux-4-19 KASAN: slab-out-of-bounds Read in dbNextAG
2022/11/14 14:05 linux-4.19.y 3f8a27f9e27b 943f4cb8 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in dbNextAG
2022/11/13 12:24 linux-4.19.y 3f8a27f9e27b f42ee5d8 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in dbNextAG
2022/11/09 21:26 linux-4.19.y 3f8a27f9e27b bebca8b7 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in dbNextAG
2022/10/23 16:57 linux-4.19.y 3f8a27f9e27b 23bf86af .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in dbNextAG
2022/10/20 02:45 linux-4.19.y 3f8a27f9e27b b31320fc .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in dbNextAG
2022/10/10 08:53 linux-4.19.y 3f8a27f9e27b aea5da89 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in dbNextAG
2022/11/05 05:22 linux-4.19.y 3f8a27f9e27b 6d752409 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 BUG: unable to handle kernel paging request in dbNextAG
2022/10/25 15:15 linux-4.19.y 3f8a27f9e27b 45645420 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 BUG: unable to handle kernel paging request in dbNextAG
2022/10/16 03:04 linux-4.19.y 3f8a27f9e27b 67cb024c .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: slab-out-of-bounds Read in dbNextAG
* Struck through repros no longer work on HEAD.