syzbot


KASAN: use-after-free Read in diFree

Status: auto-obsoleted due to no activity on 2023/10/07 20:25
Reported-by: syzbot+2b68a5a8bc4cc150db9c@syzkaller.appspotmail.com
First crash: 554d, last: 483d
Fix bisection: failed (error log, bisect log)
  
Bug presence (1)
Date Name Commit Repro Result
2023/10/07 upstream (ToT) 59f3fd30af35 C Didn't crash
Similar bugs (11)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 KASAN: use-after-free Read in diFree jfs C error 21 624d 1462d 0/1 upstream: reported C repro on 2020/10/13 01:51
upstream KASAN: use-after-free Read in diFree jfs C inconclusive unreliable 110 288d 936d 0/28 auto-obsoleted due to no activity on 2024/03/22 04:27
linux-6.1 KASAN: use-after-free Read in diFree origin:lts-only C done 7 382d 542d 3/3 fixed on 2023/10/30 11:46
linux-4.14 KASAN: use-after-free Read in diFree jfs C error 3 602d 1475d 0/1 upstream: reported C repro on 2020/09/30 00:31
linux-4.19 BUG: unable to handle kernel paging request in diFree C done 18 1184d 1476d 1/1 fixed on 2021/08/17 00:59
linux-4.14 general protection fault in diFree 1 1354d 1354d 0/1 auto-closed as invalid on 2021/05/28 19:31
linux-4.14 general protection fault in diFree (2) C 2 594d 999d 0/1 upstream: reported C repro on 2022/01/18 19:31
upstream BUG: unable to handle kernel paging request in diFree jfs C done 13 1205d 1476d 20/28 fixed on 2021/11/10 00:50
linux-5.15 UBSAN: array-index-out-of-bounds in diFree origin:upstream missing-backport C done 13 59d 105d 3/3 fixed on 2024/09/19 18:24
linux-4.14 BUG: unable to handle kernel paging request in diFree C 5 602d 1481d 0/1 upstream: reported C repro on 2020/09/23 16:53
upstream UBSAN: array-index-out-of-bounds in diFree jfs C inconclusive 226 62d 173d 27/28 fixed on 2024/08/14 03:44

Sample crash report:
loop0: detected capacity change from 0 to 14901
read_mapping_page failed!
jfs_mount: diMount failed w/rc = -5
==================================================================
BUG: KASAN: use-after-free in diFree+0x1fb7/0x2fb0 fs/jfs/jfs_imap.c:871
Read of size 4 at addr ffff888077840004 by task syz-executor361/3586

CPU: 1 PID: 3586 Comm: syz-executor361 Not tainted 5.15.117-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 print_address_description+0x63/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
 diFree+0x1fb7/0x2fb0 fs/jfs/jfs_imap.c:871
 jfs_evict_inode+0x329/0x440 fs/jfs/inode.c:156
 evict+0x2a4/0x620 fs/inode.c:587
 jfs_mount+0x532/0x830 fs/jfs/jfs_mount.c:203
 jfs_fill_super+0x5ba/0xc70 fs/jfs/super.c:561
 mount_bdev+0x2c9/0x3f0 fs/super.c:1378
 legacy_get_tree+0xeb/0x180 fs/fs_context.c:610
 vfs_get_tree+0x88/0x270 fs/super.c:1508
 do_new_mount+0x28b/0xae0 fs/namespace.c:2994
 do_mount fs/namespace.c:3337 [inline]
 __do_sys_mount fs/namespace.c:3545 [inline]
 __se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3522
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7fb8ebeb45ea
Code: 48 c7 c2 c0 ff ff ff f7 d8 64 89 02 b8 ff ff ff ff eb d2 e8 a8 00 00 00 0f 1f 84 00 00 00 00 00 49 89 ca b8 a5 00 00 00 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:00007ffc957208d8 EFLAGS: 00000282 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007fb8ebeb45ea
RDX: 0000000020005d00 RSI: 0000000020000000 RDI: 00007ffc957208e0
RBP: 00007ffc957208e0 R08: 00007ffc95720920 R09: 0000000000000002
R10: 0000000000000003 R11: 0000000000000282 R12: 0000000000000004
R13: 0000555556dc32c0 R14: 00007ffc95720920 R15: 0000000000000000
 </TASK>

Allocated by task 3498:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:434 [inline]
 __kasan_slab_alloc+0x8e/0xc0 mm/kasan/common.c:467
 kasan_slab_alloc include/linux/kasan.h:254 [inline]
 slab_post_alloc_hook+0x53/0x380 mm/slab.h:519
 slab_alloc_node mm/slub.c:3220 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 kmem_cache_alloc+0xf3/0x280 mm/slub.c:3233
 getname_flags+0xb8/0x4e0 fs/namei.c:138
 do_sys_openat2+0xd2/0x500 fs/open.c:1205
 do_sys_open fs/open.c:1227 [inline]
 __do_sys_openat fs/open.c:1243 [inline]
 __se_sys_openat fs/open.c:1238 [inline]
 __x64_sys_openat+0x243/0x290 fs/open.c:1238
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Freed by task 3498:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x80 mm/kasan/common.c:46
 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360
 ____kasan_slab_free+0xd8/0x120 mm/kasan/common.c:366
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:1705 [inline]
 slab_free_freelist_hook+0xdd/0x160 mm/slub.c:1731
 slab_free mm/slub.c:3499 [inline]
 kmem_cache_free+0x91/0x1f0 mm/slub.c:3515
 do_sys_openat2+0x434/0x500 fs/open.c:1220
 do_sys_open fs/open.c:1227 [inline]
 __do_sys_openat fs/open.c:1243 [inline]
 __se_sys_openat fs/open.c:1238 [inline]
 __x64_sys_openat+0x243/0x290 fs/open.c:1238
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

The buggy address belongs to the object at ffff888077840000
 which belongs to the cache names_cache of size 4096
The buggy address is located 4 bytes inside of
 4096-byte region [ffff888077840000, ffff888077841000)
The buggy address belongs to the page:
page:ffffea0001de1000 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x77840
head:ffffea0001de1000 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 0000000000000000 0000000100000001 ffff888011dc6500
raw: 0000000000000000 0000000000070007 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 3511, ts 44785834108, free_ts 44694744774
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x322a/0x33c0 mm/page_alloc.c:4159
 __alloc_pages+0x272/0x700 mm/page_alloc.c:5421
 alloc_slab_page mm/slub.c:1775 [inline]
 allocate_slab mm/slub.c:1912 [inline]
 new_slab+0xbb/0x4b0 mm/slub.c:1975
 ___slab_alloc+0x6f6/0xe10 mm/slub.c:3008
 __slab_alloc mm/slub.c:3095 [inline]
 slab_alloc_node mm/slub.c:3186 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 kmem_cache_alloc+0x18e/0x280 mm/slub.c:3233
 getname_flags+0xb8/0x4e0 fs/namei.c:138
 do_sys_openat2+0xd2/0x500 fs/open.c:1205
 do_sys_open fs/open.c:1227 [inline]
 __do_sys_openat fs/open.c:1243 [inline]
 __se_sys_openat fs/open.c:1238 [inline]
 __x64_sys_openat+0x243/0x290 fs/open.c:1238
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1340 [inline]
 free_pcp_prepare mm/page_alloc.c:1391 [inline]
 free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317
 free_unref_page+0x95/0x2d0 mm/page_alloc.c:3396
 free_nonslab_page+0xe4/0x150 mm/slub.c:3535
 kfree+0x1cf/0x270 mm/slub.c:4556
 diUnmount+0xef/0x100 fs/jfs/jfs_imap.c:195
 jfs_mount+0x53f/0x830 fs/jfs/jfs_mount.c:205
 jfs_fill_super+0x5ba/0xc70 fs/jfs/super.c:561
 mount_bdev+0x2c9/0x3f0 fs/super.c:1378
 legacy_get_tree+0xeb/0x180 fs/fs_context.c:610
 vfs_get_tree+0x88/0x270 fs/super.c:1508
 do_new_mount+0x28b/0xae0 fs/namespace.c:2994
 do_mount fs/namespace.c:3337 [inline]
 __do_sys_mount fs/namespace.c:3545 [inline]
 __se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3522
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Memory state around the buggy address:
 ffff88807783ff00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88807783ff80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888077840000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff888077840080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888077840100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (5):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/06/19 02:59 linux-5.15.y 471e639e59d1 f3921d4d .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan KASAN: use-after-free Read in diFree
2023/05/24 01:07 linux-5.15.y 9d6bde853685 4bce1a3e .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in diFree
2023/05/28 04:48 linux-5.15.y 1fe619a7d252 cf184559 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in diFree
2023/04/15 11:44 linux-5.15.y 4fdad925aa1a ec410564 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in diFree
2023/04/08 06:48 linux-5.15.y d86dfc4d95cd 71147e29 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in diFree
* Struck through repros no longer work on HEAD.