syzbot


KASAN: use-after-free Read in release_metapage (2)

Status: auto-obsoleted due to no activity on 2024/08/10 05:44
Reported-by: syzbot+8c3eb1c2604e62f1e28d@syzkaller.appspotmail.com
First crash: 215d, last: 215d
Similar bugs (7)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 KASAN: use-after-free Read in release_metapage (2) 2 14d 21d 0/3 upstream: reported on 2024/11/12 12:14
upstream KASAN: use-after-free Read in release_metapage jfs C error done 1094 2h03m 701d 0/28 upstream: reported C repro on 2023/01/02 10:00
linux-6.1 KASAN: use-after-free Read in release_metapage 1 440d 440d 0/3 auto-obsoleted due to no activity on 2023/12/29 12:55
linux-4.14 KASAN: use-after-free Read in release_metapage 1 755d 755d 0/1 auto-obsoleted due to no activity on 2023/03/09 00:53
linux-5.15 KASAN: use-after-free Read in release_metapage 1 418d 418d 0/3 auto-obsoleted due to no activity on 2024/01/20 09:39
linux-6.1 KASAN: use-after-free Read in release_metapage (3) 1 21d 21d 0/3 upstream: reported on 2024/11/12 12:24
linux-5.15 BUG: spinlock bad magic in release_metapage origin:upstream C 34 1d22h 79d 0/3 upstream: reported C repro on 2024/09/15 11:43

Sample crash report:
ERROR: (device loop3): release_metapage: write_one_page() failed
ERROR: (device loop3): remounting filesystem as read-only
==================================================================
BUG: KASAN: use-after-free in drop_metapage fs/jfs/jfs_metapage.c:223 [inline]
BUG: KASAN: use-after-free in release_metapage+0x70c/0xc84 fs/jfs/jfs_metapage.c:757
Read of size 8 at addr ffff0000ca096120 by task syz-executor.3/5438

CPU: 0 PID: 5438 Comm: syz-executor.3 Not tainted 6.1.89-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Call trace:
 dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:284 [inline]
 print_report+0x174/0x4c0 mm/kasan/report.c:395
 kasan_report+0xd4/0x130 mm/kasan/report.c:495
 __asan_report_load8_noabort+0x2c/0x38 mm/kasan/report_generic.c:351
 drop_metapage fs/jfs/jfs_metapage.c:223 [inline]
 release_metapage+0x70c/0xc84 fs/jfs/jfs_metapage.c:757
 write_metapage fs/jfs/jfs_metapage.h:75 [inline]
 flush_metapage fs/jfs/jfs_metapage.h:81 [inline]
 ea_write+0x50c/0xba0 fs/jfs/xattr.c:280
 ea_put fs/jfs/xattr.c:610 [inline]
 __jfs_setxattr+0xc10/0x1338 fs/jfs/xattr.c:783
 __jfs_xattr_set+0xf8/0x190 fs/jfs/xattr.c:917
 jfs_xattr_set+0x58/0x70 fs/jfs/xattr.c:941
 __vfs_setxattr+0x388/0x3a4 fs/xattr.c:182
 __vfs_setxattr_noperm+0x110/0x528 fs/xattr.c:216
 __vfs_setxattr_locked+0x1ec/0x218 fs/xattr.c:277
 vfs_setxattr+0x1a8/0x344 fs/xattr.c:309
 do_setxattr fs/xattr.c:594 [inline]
 setxattr+0x230/0x294 fs/xattr.c:617
 path_setxattr+0x17c/0x258 fs/xattr.c:636
 __do_sys_setxattr fs/xattr.c:652 [inline]
 __se_sys_setxattr fs/xattr.c:648 [inline]
 __arm64_sys_setxattr+0xbc/0xd8 fs/xattr.c:648
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
 do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

Allocated by task 5438:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4c/0x80 mm/kasan/common.c:52
 kasan_save_alloc_info+0x24/0x30 mm/kasan/generic.c:505
 __kasan_slab_alloc+0x74/0x8c mm/kasan/common.c:328
 kasan_slab_alloc include/linux/kasan.h:201 [inline]
 slab_post_alloc_hook+0x74/0x458 mm/slab.h:737
 slab_alloc_node mm/slub.c:3398 [inline]
 slab_alloc mm/slub.c:3406 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3413 [inline]
 kmem_cache_alloc+0x230/0x37c mm/slub.c:3422
 mempool_alloc_slab+0x58/0x74 mm/mempool.c:512
 mempool_alloc+0x150/0x48c mm/mempool.c:392
 alloc_metapage fs/jfs/jfs_metapage.c:176 [inline]
 __get_metapage+0x618/0x1050 fs/jfs/jfs_metapage.c:651
 ea_write+0x49c/0xba0 fs/jfs/xattr.c:256
 ea_put fs/jfs/xattr.c:610 [inline]
 __jfs_setxattr+0xc10/0x1338 fs/jfs/xattr.c:783
 __jfs_xattr_set+0xf8/0x190 fs/jfs/xattr.c:917
 jfs_xattr_set+0x58/0x70 fs/jfs/xattr.c:941
 __vfs_setxattr+0x388/0x3a4 fs/xattr.c:182
 __vfs_setxattr_noperm+0x110/0x528 fs/xattr.c:216
 __vfs_setxattr_locked+0x1ec/0x218 fs/xattr.c:277
 vfs_setxattr+0x1a8/0x344 fs/xattr.c:309
 do_setxattr fs/xattr.c:594 [inline]
 setxattr+0x230/0x294 fs/xattr.c:617
 path_setxattr+0x17c/0x258 fs/xattr.c:636
 __do_sys_setxattr fs/xattr.c:652 [inline]
 __se_sys_setxattr fs/xattr.c:648 [inline]
 __arm64_sys_setxattr+0xbc/0xd8 fs/xattr.c:648
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
 do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

Freed by task 5448:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4c/0x80 mm/kasan/common.c:52
 kasan_save_free_info+0x38/0x5c mm/kasan/generic.c:516
 ____kasan_slab_free+0x144/0x1c0 mm/kasan/common.c:236
 __kasan_slab_free+0x18/0x28 mm/kasan/common.c:244
 kasan_slab_free include/linux/kasan.h:177 [inline]
 slab_free_hook mm/slub.c:1724 [inline]
 slab_free_freelist_hook mm/slub.c:1750 [inline]
 slab_free mm/slub.c:3661 [inline]
 kmem_cache_free+0x2f0/0x588 mm/slub.c:3683
 mempool_free_slab+0x28/0x38 mm/mempool.c:519
 mempool_free+0xbc/0x2e0 mm/mempool.c:501
 free_metapage fs/jfs/jfs_metapage.c:191 [inline]
 metapage_release_folio+0x448/0x5b4 fs/jfs/jfs_metapage.c:551
 metapage_invalidate_folio+0x140/0x1d8 fs/jfs/jfs_metapage.c:563
 folio_invalidate mm/truncate.c:158 [inline]
 truncate_cleanup_folio+0x174/0x2e0 mm/truncate.c:178
 truncate_inode_pages_range+0x244/0xf10 mm/truncate.c:368
 truncate_inode_pages+0x2c/0x3c mm/truncate.c:451
 jfs_remount+0x2dc/0x594 fs/jfs/super.c:451
 legacy_reconfigure+0xfc/0x114 fs/fs_context.c:655
 reconfigure_super+0x318/0x7a4 fs/super.c:966
 vfs_fsconfig_locked fs/fsopen.c:254 [inline]
 __do_sys_fsconfig fs/fsopen.c:439 [inline]
 __se_sys_fsconfig fs/fsopen.c:314 [inline]
 __arm64_sys_fsconfig+0xa1c/0xd18 fs/fsopen.c:314
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
 do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

The buggy address belongs to the object at ffff0000ca0960f8
 which belongs to the cache jfs_mp of size 184
The buggy address is located 40 bytes inside of
 184-byte region [ffff0000ca0960f8, ffff0000ca0961b0)

The buggy address belongs to the physical page:
page:000000004e8a40f7 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10a096
flags: 0x5ffe00000000200(slab|node=0|zone=2|lastcpupid=0xfff)
raw: 05ffe00000000200 0000000000000000 dead000000000001 ffff0000c6ee7c80
raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff0000ca096000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000ca096080: fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc fa
>ffff0000ca096100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                               ^
 ffff0000ca096180: fb fb fb fb fb fb fc fc fc fc fc fc fc fc fa fb
 ffff0000ca096200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/05/02 05:43 linux-6.1.y dcbc050cb0d3 3ba885bc .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in release_metapage
* Struck through repros no longer work on HEAD.