syzbot


KASAN: use-after-free Read in diAlloc

Status: upstream: reported C repro on 2022/10/02 23:41
Reported-by: syzbot+509be8151ee976013200@syzkaller.appspotmail.com
First crash: 569d, last: 525d
Fix bisection: failed (error log, bisect log)
  
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: use-after-free Read in diAlloc C 2 424d 569d 0/1 upstream: reported C repro on 2022/10/03 09:45
linux-5.15 UBSAN: array-index-out-of-bounds in diAlloc 3 148d 148d 0/3 auto-obsoleted due to no activity on 2024/03/07 05:11
upstream UBSAN: array-index-out-of-bounds in diAlloc jfs C error inconclusive 37 166d 575d 25/26 fixed on 2023/12/21 03:45
linux-6.1 UBSAN: array-index-out-of-bounds in diAlloc 4 148d 166d 0/3 auto-obsoleted due to no activity on 2024/03/07 03:48

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 diAlloc+0x20e/0x1440 fs/jfs/jfs_imap.c:1374
Read of size 4 at addr ffff8880b02a468c by task syz-executor337/8112

CPU: 1 PID: 8112 Comm: syz-executor337 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]
 diAlloc+0x20e/0x1440 fs/jfs/jfs_imap.c:1374
 ialloc+0x8c/0x970 fs/jfs/jfs_inode.c:69
 jfs_create.part.0+0x12b/0x880 fs/jfs/namei.c:105
 jfs_create+0x3f/0x60 fs/jfs/namei.c:90
 lookup_open+0x893/0x1a20 fs/namei.c:3235
 do_last fs/namei.c:3327 [inline]
 path_openat+0x1094/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
RIP: 0033:0x7fe0d9ce1eb9
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:00007fffbe6589f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000002
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fe0d9ce1eb9
RDX: 0000000000000000 RSI: 0000000000141042 RDI: 0000000020000200
RBP: 00007fe0d9ca1720 R08: 00005555563b82c0 R09: 0000000000000000
R10: 00007fffbe6588c0 R11: 0000000000000246 R12: 0000000200000004
R13: 0000000000000000 R14: 00080000000000f8 R15: 0000000000000000

Allocated by task 6238:
 kmem_cache_alloc+0x122/0x370 mm/slab.c:3559
 getname_flags+0xce/0x590 fs/namei.c:140
 user_path_at_empty+0x2a/0x50 fs/namei.c:2609
 do_readlinkat+0xcd/0x2f0 fs/stat.c:394
 __do_sys_readlinkat fs/stat.c:421 [inline]
 __se_sys_readlinkat fs/stat.c:418 [inline]
 __x64_sys_readlinkat+0x93/0xf0 fs/stat.c:418
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 6238:
 __cache_free mm/slab.c:3503 [inline]
 kmem_cache_free+0x7f/0x260 mm/slab.c:3765
 putname+0xe1/0x120 fs/namei.c:261
 filename_lookup+0x3d0/0x5a0 fs/namei.c:2358
 do_readlinkat+0xcd/0x2f0 fs/stat.c:394
 __do_sys_readlinkat fs/stat.c:421 [inline]
 __se_sys_readlinkat fs/stat.c:418 [inline]
 __x64_sys_readlinkat+0x93/0xf0 fs/stat.c:418
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880b02a4380
 which belongs to the cache names_cache of size 4096
The buggy address is located 780 bytes inside of
 4096-byte region [ffff8880b02a4380, ffff8880b02a5380)
The buggy address belongs to the page:
page:ffffea0002c0a900 count:1 mapcount:0 mapping:ffff88823b843380 index:0x0 compound_mapcount: 0
flags: 0xfff00000008100(slab|head)
raw: 00fff00000008100 ffffea0002522808 ffffea0002beee08 ffff88823b843380
raw: 0000000000000000 ffff8880b02a4380 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880b02a4580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880b02a4600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880b02a4680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                      ^
 ffff8880b02a4700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880b02a4780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/10/02 23:41 linux-4.19.y 3f8a27f9e27b feb56351 .config console log report syz C [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in diAlloc
2022/11/16 14:49 linux-4.19.y 3f8a27f9e27b 3a127a31 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in diAlloc
2022/10/12 21:38 linux-4.19.y 3f8a27f9e27b 16a9c9e0 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: slab-out-of-bounds Read in diAlloc
* Struck through repros no longer work on HEAD.