syzbot


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

Status: auto-obsoleted due to no activity on 2025/05/01 23:31
Reported-by: syzbot+4b6494f0e706e8a1fe4d@syzkaller.appspotmail.com
First crash: 180d, last: 110d
Similar bugs (8)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in release_metapage jfs C error done 1233 4d21h 860d 0/28 upstream: reported C repro on 2023/01/02 10:00
linux-6.1 KASAN: use-after-free Read in release_metapage 1 599d 599d 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 915d 915d 0/1 auto-obsoleted due to no activity on 2023/03/09 00:53
linux-6.1 KASAN: use-after-free Read in release_metapage (2) 1 374d 374d 0/3 auto-obsoleted due to no activity on 2024/08/10 05:44
linux-5.15 KASAN: use-after-free Read in release_metapage 1 577d 577d 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 180d 180d 0/3 auto-obsoleted due to no activity on 2025/02/20 12:24
linux-5.15 BUG: spinlock bad magic in release_metapage origin:upstream C 74 3d23h 238d 0/3 upstream: reported C repro on 2024/09/15 11:43
upstream BUG: spinlock bad magic in release_metapage jfs C inconclusive 500 2h17m 243d 0/28 upstream: reported C repro on 2024/09/10 08:16

Sample crash report:
ERROR: (device loop4): release_metapage: write_one_page() failed
ERROR: (device loop4): remounting filesystem as read-only
==================================================================
BUG: KASAN: use-after-free in drop_metapage fs/jfs/jfs_metapage.c:222 [inline]
BUG: KASAN: use-after-free in release_metapage+0x829/0xe00 fs/jfs/jfs_metapage.c:758
Read of size 8 at addr ffff888073f08cc0 by task syz.4.227/5623

CPU: 1 PID: 5623 Comm: syz.4.227 Not tainted 5.15.176-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2d0 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
 drop_metapage fs/jfs/jfs_metapage.c:222 [inline]
 release_metapage+0x829/0xe00 fs/jfs/jfs_metapage.c:758
 write_metapage fs/jfs/jfs_metapage.h:75 [inline]
 flush_metapage fs/jfs/jfs_metapage.h:81 [inline]
 ea_write+0x69f/0xe50 fs/jfs/xattr.c:280
 ea_put fs/jfs/xattr.c:621 [inline]
 __jfs_setxattr+0x8a5/0x11d0 fs/jfs/xattr.c:787
 __jfs_xattr_set+0xf5/0x180 fs/jfs/xattr.c:936
 __vfs_setxattr+0x3e7/0x420 fs/xattr.c:182
 __vfs_setxattr_noperm+0x12a/0x5e0 fs/xattr.c:216
 vfs_setxattr+0x21d/0x420 fs/xattr.c:303
 do_setxattr fs/xattr.c:588 [inline]
 setxattr+0x27e/0x2e0 fs/xattr.c:611
 path_setxattr+0x1bc/0x2a0 fs/xattr.c:630
 __do_sys_lsetxattr fs/xattr.c:653 [inline]
 __se_sys_lsetxattr fs/xattr.c:649 [inline]
 __x64_sys_lsetxattr+0xb4/0xd0 fs/xattr.c:649
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7fb2819ecd29
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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fb27f81b038 EFLAGS: 00000246 ORIG_RAX: 00000000000000bd
RAX: ffffffffffffffda RBX: 00007fb281bdd160 RCX: 00007fb2819ecd29
RDX: 0000000000000000 RSI: 0000000020000080 RDI: 0000000020000040
RBP: 00007fb281a68b08 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000001 R14: 00007fb281bdd160 R15: 00007ffc5d0134d8
 </TASK>

Allocated by task 5623:
 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
 mempool_alloc+0x17f/0x590 mm/mempool.c:393
 alloc_metapage fs/jfs/jfs_metapage.c:175 [inline]
 __get_metapage+0x672/0x1070 fs/jfs/jfs_metapage.c:652
 ea_write+0x633/0xe50 fs/jfs/xattr.c:256
 ea_put fs/jfs/xattr.c:621 [inline]
 __jfs_setxattr+0x8a5/0x11d0 fs/jfs/xattr.c:787
 __jfs_xattr_set+0xf5/0x180 fs/jfs/xattr.c:936
 __vfs_setxattr+0x3e7/0x420 fs/xattr.c:182
 __vfs_setxattr_noperm+0x12a/0x5e0 fs/xattr.c:216
 vfs_setxattr+0x21d/0x420 fs/xattr.c:303
 do_setxattr fs/xattr.c:588 [inline]
 setxattr+0x27e/0x2e0 fs/xattr.c:611
 path_setxattr+0x1bc/0x2a0 fs/xattr.c:630
 __do_sys_lsetxattr fs/xattr.c:653 [inline]
 __se_sys_lsetxattr fs/xattr.c:649 [inline]
 __x64_sys_lsetxattr+0xb4/0xd0 fs/xattr.c:649
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Freed by task 5622:
 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
 free_metapage fs/jfs/jfs_metapage.c:190 [inline]
 metapage_releasepage+0x5cb/0x730 fs/jfs/jfs_metapage.c:552
 do_invalidatepage mm/truncate.c:157 [inline]
 truncate_cleanup_page+0x179/0x440 mm/truncate.c:176
 truncate_inode_pages_range+0x2e7/0x1290 mm/truncate.c:325
 jfs_remount+0x360/0x6a0 fs/jfs/super.c:456
 reconfigure_super+0x43a/0x870 fs/super.c:938
 vfs_fsconfig_locked fs/fsopen.c:254 [inline]
 __do_sys_fsconfig fs/fsopen.c:439 [inline]
 __se_sys_fsconfig+0x98b/0xec0 fs/fsopen.c:314
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

The buggy address belongs to the object at ffff888073f08c98
 which belongs to the cache jfs_mp of size 184
The buggy address is located 40 bytes inside of
 184-byte region [ffff888073f08c98, ffff888073f08d50)
The buggy address belongs to the page:
page:ffffea0001cfc200 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x73f08
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 0000000000000000 dead000000000122 ffff88801e763140
raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x192800(GFP_NOWAIT|__GFP_NOWARN|__GFP_NORETRY|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 4178, ts 124103028461, free_ts 124088386625
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x3b78/0x3d40 mm/page_alloc.c:4192
 __alloc_pages+0x272/0x700 mm/page_alloc.c:5465
 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
 mempool_alloc+0x17f/0x590 mm/mempool.c:393
 alloc_metapage fs/jfs/jfs_metapage.c:175 [inline]
 __get_metapage+0x672/0x1070 fs/jfs/jfs_metapage.c:652
 diWriteSpecial+0x1a1/0x440 fs/jfs/jfs_imap.c:518
 diSync+0x4b6/0x6e0 fs/jfs/jfs_imap.c:251
 diUnmount+0xc3/0x120 fs/jfs/jfs_imap.c:185
 jfs_umount+0x174/0x370 fs/jfs/jfs_umount.c:73
 jfs_put_super+0x86/0x180 fs/jfs/super.c:194
 generic_shutdown_super+0x130/0x310 fs/super.c:475
 kill_block_super+0x7a/0xe0 fs/super.c:1427
 deactivate_locked_super+0xa0/0x110 fs/super.c:335
 cleanup_mnt+0x44e/0x500 fs/namespace.c:1143
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_slab mm/slub.c:2015 [inline]
 discard_slab mm/slub.c:2021 [inline]
 __unfreeze_partials+0x1b7/0x210 mm/slub.c:2507
 put_cpu_partial+0x132/0x1a0 mm/slub.c:2587
 do_slab_free mm/slub.c:3487 [inline]
 ___cache_free+0xe3/0x100 mm/slub.c:3506
 qlist_free_all+0x36/0x90 mm/kasan/quarantine.c:176
 kasan_quarantine_reduce+0x162/0x180 mm/kasan/quarantine.c:283
 __kasan_slab_alloc+0x2f/0xc0 mm/kasan/common.c:444
 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
 vm_area_dup+0x1e/0xb0 kernel/fork.c:358
 __split_vma+0xb4/0x420 mm/mmap.c:2718
 __do_munmap+0x402/0x1710 mm/mmap.c:2853
 do_munmap mm/mmap.c:2898 [inline]
 munmap_vma_range mm/mmap.c:602 [inline]
 __mmap_region mm/mmap.c:1745 [inline]
 mmap_region+0x9f9/0x1870 mm/mmap.c:2921
 do_mmap+0x78d/0xe00 mm/mmap.c:1574
 vm_mmap_pgoff+0x1ca/0x2d0 mm/util.c:551

Memory state around the buggy address:
 ffff888073f08b80: fc fc fc fc 00 00 00 00 00 00 00 00 00 00 00 00
 ffff888073f08c00: 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc
>ffff888073f08c80: fc fc fc fa fb fb fb fb fb fb fb fb fb fb fb fb
                                           ^
 ffff888073f08d00: fb fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc
 ffff888073f08d80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/01/21 23:30 linux-5.15.y 4735586da88e da72ac06 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in release_metapage
2024/11/12 12:13 linux-5.15.y 3c17fc483905 75bb1b32 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in release_metapage
2024/11/19 10:57 linux-5.15.y 0a51d2d4527b 571351cb .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in release_metapage
* Struck through repros no longer work on HEAD.