syzbot


KASAN: use-after-free Read in release_metapage

Status: upstream: reported C repro on 2023/01/02 10:00
Labels: jfs (incorrect?)
Reported-by: syzbot+f1521383cec5f7baaa94@syzkaller.appspotmail.com
First crash: 164d, last: 21h25m

Cause bisection: failed (error log, bisect log)
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [jfs?] KASAN: use-after-free Read in release_metapage 0 (2) 2023/05/19 04:17
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: use-after-free Read in release_metapage 1 205d 205d 0/1 auto-obsoleted due to no activity on 2023/03/09 00:53

Sample crash report:
==================================================================
BUG: KASAN: slab-use-after-free in drop_metapage fs/jfs/jfs_metapage.c:223 [inline]
BUG: KASAN: slab-use-after-free in release_metapage+0x5a7/0x870 fs/jfs/jfs_metapage.c:786
Read of size 8 at addr ffff888029b76218 by task syz-executor361/5082

CPU: 1 PID: 5082 Comm: syz-executor361 Not tainted 6.4.0-rc2-syzkaller-00018-g4d6d4c7f541d #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/28/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:351 [inline]
 print_report+0x163/0x540 mm/kasan/report.c:462
 kasan_report+0x176/0x1b0 mm/kasan/report.c:572
 drop_metapage fs/jfs/jfs_metapage.c:223 [inline]
 release_metapage+0x5a7/0x870 fs/jfs/jfs_metapage.c:786
 write_metapage fs/jfs/jfs_metapage.h:75 [inline]
 flush_metapage fs/jfs/jfs_metapage.h:81 [inline]
 ea_put fs/jfs/xattr.c:614 [inline]
 __jfs_setxattr+0xad9/0x11d0 fs/jfs/xattr.c:783
 jfs_initxattrs+0x128/0x1d0 fs/jfs/xattr.c:1016
 security_inode_init_security+0x2df/0x3f0 security/security.c:1630
 jfs_init_security+0xa9/0x110 fs/jfs/xattr.c:1028
 jfs_mkdir+0x2c7/0xbb0 fs/jfs/namei.c:240
 vfs_mkdir+0x29d/0x450 fs/namei.c:4115
 do_mkdirat+0x264/0x520 fs/namei.c:4138
 __do_sys_mkdir fs/namei.c:4158 [inline]
 __se_sys_mkdir fs/namei.c:4156 [inline]
 __x64_sys_mkdir+0x6e/0x80 fs/namei.c:4156
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fce4779cec9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 b1 15 00 00 90 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fce40327318 EFLAGS: 00000246 ORIG_RAX: 0000000000000053
RAX: ffffffffffffffda RBX: 00007fce478287b8 RCX: 00007fce4779cec9
RDX: 00007fce40327700 RSI: 0000000000000000 RDI: 0000000020000040
RBP: 00007fce478287b0 R08: 00007fce40327700 R09: 0000000000000000
R10: 00007fce40327700 R11: 0000000000000246 R12: 0030656c69662f2e
R13: 00007ffcc2233f3f R14: 00007fce40327400 R15: 0000000000022000
 </TASK>

Allocated by task 5082:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4f/0x70 mm/kasan/common.c:52
 __kasan_slab_alloc+0x66/0x70 mm/kasan/common.c:328
 kasan_slab_alloc include/linux/kasan.h:186 [inline]
 slab_post_alloc_hook+0x68/0x3a0 mm/slab.h:711
 slab_alloc_node mm/slub.c:3451 [inline]
 slab_alloc mm/slub.c:3459 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3466 [inline]
 kmem_cache_alloc+0x11f/0x2e0 mm/slub.c:3475
 mempool_alloc+0x194/0x580 mm/mempool.c:398
 alloc_metapage fs/jfs/jfs_metapage.c:176 [inline]
 __get_metapage+0x574/0x10e0 fs/jfs/jfs_metapage.c:651
 ea_get+0xb3f/0x1280 fs/jfs/xattr.c:526
 __jfs_setxattr+0x4ba/0x11d0 fs/jfs/xattr.c:718
 jfs_initxattrs+0x128/0x1d0 fs/jfs/xattr.c:1016
 security_inode_init_security+0x2df/0x3f0 security/security.c:1630
 jfs_init_security+0xa9/0x110 fs/jfs/xattr.c:1028
 jfs_mkdir+0x2c7/0xbb0 fs/jfs/namei.c:240
 vfs_mkdir+0x29d/0x450 fs/namei.c:4115
 do_mkdirat+0x264/0x520 fs/namei.c:4138
 __do_sys_mkdir fs/namei.c:4158 [inline]
 __se_sys_mkdir fs/namei.c:4156 [inline]
 __x64_sys_mkdir+0x6e/0x80 fs/namei.c:4156
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Freed by task 5074:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4f/0x70 mm/kasan/common.c:52
 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:521
 ____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236
 kasan_slab_free include/linux/kasan.h:162 [inline]
 slab_free_hook mm/slub.c:1781 [inline]
 slab_free_freelist_hook mm/slub.c:1807 [inline]
 slab_free mm/slub.c:3786 [inline]
 kmem_cache_free+0x297/0x520 mm/slub.c:3808
 free_metapage fs/jfs/jfs_metapage.c:191 [inline]
 metapage_release_folio+0x5cc/0x730 fs/jfs/jfs_metapage.c:551
 shrink_folio_list+0x26f1/0x8940 mm/vmscan.c:2076
 shrink_inactive_list mm/vmscan.c:2602 [inline]
 shrink_list mm/vmscan.c:2843 [inline]
 shrink_lruvec+0x16e6/0x2d30 mm/vmscan.c:6279
 shrink_node_memcgs mm/vmscan.c:6466 [inline]
 shrink_node+0x115c/0x2790 mm/vmscan.c:6501
 shrink_zones mm/vmscan.c:6736 [inline]
 do_try_to_free_pages+0x67e/0x1900 mm/vmscan.c:6798
 try_to_free_mem_cgroup_pages+0x455/0xa50 mm/vmscan.c:7113
 try_charge_memcg+0x5de/0x16d0 mm/memcontrol.c:2724
 try_charge mm/memcontrol.c:2866 [inline]
 mem_cgroup_charge_skmem+0xad/0x2b0 mm/memcontrol.c:7351
 sock_reserve_memory+0x101/0x610 net/core/sock.c:1025
 sk_setsockopt+0xc8e/0x3430 net/core/sock.c:1520
 __sys_setsockopt+0x47b/0x980 net/socket.c:2269
 __do_sys_setsockopt net/socket.c:2284 [inline]
 __se_sys_setsockopt net/socket.c:2281 [inline]
 __x64_sys_setsockopt+0xb5/0xd0 net/socket.c:2281
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

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

The buggy address belongs to the physical page:
page:ffffea0000a6dd80 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x29b76
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000200 ffff888142ae6000 dead000000000122 0000000000000000
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 5082, tgid 5073 (syz-executor361), ts 74009954920, free_ts 73972179887
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x1e6/0x210 mm/page_alloc.c:1731
 prep_new_page mm/page_alloc.c:1738 [inline]
 get_page_from_freelist+0x321c/0x33a0 mm/page_alloc.c:3502
 __alloc_pages+0x255/0x670 mm/page_alloc.c:4768
 alloc_slab_page+0x6a/0x160 mm/slub.c:1851
 allocate_slab mm/slub.c:1998 [inline]
 new_slab+0x84/0x2f0 mm/slub.c:2051
 ___slab_alloc+0xa85/0x10a0 mm/slub.c:3192
 __slab_alloc mm/slub.c:3291 [inline]
 __slab_alloc_node mm/slub.c:3344 [inline]
 slab_alloc_node mm/slub.c:3441 [inline]
 slab_alloc mm/slub.c:3459 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3466 [inline]
 kmem_cache_alloc+0x1b9/0x2e0 mm/slub.c:3475
 mempool_alloc+0x194/0x580 mm/mempool.c:398
 alloc_metapage fs/jfs/jfs_metapage.c:176 [inline]
 __get_metapage+0x574/0x10e0 fs/jfs/jfs_metapage.c:651
 diNewExt+0xbe0/0x4000 fs/jfs/jfs_imap.c:2265
 diAllocExt fs/jfs/jfs_imap.c:1945 [inline]
 diAllocAG+0xbe8/0x1e50 fs/jfs/jfs_imap.c:1662
 diAlloc+0x3e1/0x1720 fs/jfs/jfs_imap.c:1583
 ialloc+0x8f/0x980 fs/jfs/jfs_inode.c:56
 jfs_mkdir+0x1c5/0xbb0 fs/jfs/namei.c:225
 vfs_mkdir+0x29d/0x450 fs/namei.c:4115
 do_mkdirat+0x264/0x520 fs/namei.c:4138
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1302 [inline]
 free_unref_page_prepare+0x903/0xa30 mm/page_alloc.c:2564
 free_unref_page+0x37/0x3f0 mm/page_alloc.c:2659
 qlist_free_all+0x22/0x60 mm/kasan/quarantine.c:185
 kasan_quarantine_reduce+0x14b/0x160 mm/kasan/quarantine.c:292
 __kasan_slab_alloc+0x23/0x70 mm/kasan/common.c:305
 kasan_slab_alloc include/linux/kasan.h:186 [inline]
 slab_post_alloc_hook+0x68/0x3a0 mm/slab.h:711
 slab_alloc_node mm/slub.c:3451 [inline]
 __kmem_cache_alloc_node+0x14c/0x290 mm/slub.c:3490
 __do_kmalloc_node mm/slab_common.c:965 [inline]
 __kmalloc_node+0xa7/0x230 mm/slab_common.c:973
 kmalloc_node include/linux/slab.h:579 [inline]
 kvmalloc_node+0x72/0x180 mm/util.c:604
 kvmalloc include/linux/slab.h:697 [inline]
 seq_buf_alloc fs/seq_file.c:38 [inline]
 seq_read_iter+0x202/0xd10 fs/seq_file.c:210
 call_read_iter include/linux/fs.h:1862 [inline]
 new_sync_read fs/read_write.c:389 [inline]
 vfs_read+0x788/0xb00 fs/read_write.c:470
 ksys_read+0x1a0/0x2c0 fs/read_write.c:613
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Memory state around the buggy address:
 ffff888029b76100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888029b76180: fb fb fb fb fb fb fc fc fc fc fc fc fc fc fa fb
>ffff888029b76200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                            ^
 ffff888029b76280: fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc
 ffff888029b76300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (114):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Manager Title
2023/05/19 04:17 upstream 4d6d4c7f541d 3bb7af1d .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-gce-smack-root KASAN: slab-use-after-free Read in release_metapage
2023/01/06 10:57 upstream 1f5abbd77e2c 1dac8c7a .config console log report info ci-qemu-upstream KASAN: use-after-free Read in release_metapage
2022/12/19 23:16 upstream 2f26e424552e c52b2efb .config console log report info ci-qemu-upstream KASAN: use-after-free Read in release_metapage
2023/05/23 14:53 upstream ae8373a5add4 4bce1a3e .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in release_metapage
2023/05/23 13:18 upstream ae8373a5add4 4bce1a3e .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in release_metapage
2023/05/21 08:09 upstream 0dd2a6fb1e34 4bce1a3e .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in release_metapage
2023/05/20 07:58 upstream 5565ec4ef4f0 96689200 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in release_metapage
2023/05/19 03:50 upstream 4d6d4c7f541d 3bb7af1d .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root KASAN: slab-use-after-free Read in release_metapage
2023/05/18 15:36 upstream 4d6d4c7f541d 3bb7af1d .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in release_metapage
2023/05/18 14:00 upstream 4d6d4c7f541d 3bb7af1d .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in release_metapage
2023/05/17 10:04 upstream f1fcbaa18b28 eaac4681 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in release_metapage
2023/05/16 17:51 upstream f1fcbaa18b28 11c89444 .config console log report info ci-qemu-upstream KASAN: slab-use-after-free Read in release_metapage
2023/05/15 23:44 upstream f1fcbaa18b28 71b00cfb .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in release_metapage
2023/05/15 13:25 upstream f1fcbaa18b28 b8bae4ab .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in release_metapage
2023/05/13 21:57 upstream 9a48d6046722 2b9ba477 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in release_metapage
2023/05/13 19:31 upstream 9a48d6046722 2b9ba477 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in release_metapage
2023/05/12 18:31 upstream cc3c44c9fda2 893599a2 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in release_metapage
2023/05/12 15:57 upstream cc3c44c9fda2 893599a2 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in release_metapage
2023/05/12 10:01 upstream cc3c44c9fda2 adb9a3cd .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in release_metapage
2023/05/09 14:18 upstream ba0ad6ed89fd f4168103 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in release_metapage
2023/05/09 09:18 upstream ba0ad6ed89fd f4168103 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in release_metapage
2023/05/08 23:11 upstream ba0ad6ed89fd 33db58a6 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in release_metapage
2023/05/08 09:56 upstream ac9a78681b92 90c93c40 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in release_metapage
2023/05/07 12:27 upstream fc4354c6e5c2 90c93c40 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in release_metapage
2023/05/07 10:18 upstream fc4354c6e5c2 90c93c40 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in release_metapage
2023/05/06 18:54 upstream 2e1e1337881b 90c93c40 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in release_metapage
2023/05/05 03:44 upstream 3c4aa4434377 518a39a6 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in release_metapage
2023/05/04 09:26 upstream fa31fc82fb77 5b7ff9dd .config console log report info ci-qemu-upstream KASAN: slab-use-after-free Read in release_metapage
2023/05/04 04:17 upstream fa31fc82fb77 b5918830 .config console log report info ci-qemu-upstream KASAN: slab-use-after-free Read in release_metapage
2023/05/03 09:29 upstream 7df047b3f0aa 48e0a81d .config console log report info ci-qemu-upstream KASAN: slab-use-after-free Read in release_metapage
2023/04/30 04:56 upstream 1ae78a14516b 62df2017 .config console log report info ci-qemu-upstream KASAN: slab-use-after-free Read in release_metapage
2023/03/26 16:54 upstream da8e7da11e4b fbf0499a .config console log report info ci-qemu-upstream KFENCE: use-after-free in release_metapage
2023/06/01 17:26 upstream 929ed21dfdb6 a4ae4f42 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in release_metapage
2023/06/01 05:26 upstream 929ed21dfdb6 babc4389 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in release_metapage
2023/05/31 01:52 upstream afead42fdfca 09898419 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in release_metapage
2023/05/31 00:47 upstream afead42fdfca 09898419 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in release_metapage
2023/05/28 22:16 upstream 7877cb91f108 cf184559 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in release_metapage
2023/05/25 00:02 upstream 933174ae28ba 4bce1a3e .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in release_metapage
2023/05/24 15:21 upstream 9d646009f65d 4bce1a3e .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in release_metapage
2023/05/21 23:29 upstream e2065b8c1b01 4bce1a3e .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in release_metapage
2023/05/20 06:31 upstream 5565ec4ef4f0 96689200 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in release_metapage
2023/05/16 05:42 upstream f1fcbaa18b28 71b00cfb .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in release_metapage
2023/05/14 12:51 upstream bb7c241fae62 2b9ba477 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in release_metapage
2023/05/10 12:21 upstream 16a8829130ca 14b12a99 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in release_metapage
2023/05/04 11:53 upstream 1a5304fecee5 44cadb8c .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in release_metapage
2023/05/02 10:38 upstream 865fdb08197e 52d40fd2 .config console log report info ci-qemu-upstream-386 KASAN: slab-use-after-free Read in release_metapage
2023/05/01 23:13 upstream c8c655c34e33 62df2017 .config console log report info ci-qemu-upstream-386 KASAN: slab-use-after-free Read in release_metapage
2023/05/01 01:57 upstream 58390c8ce1bd 62df2017 .config console log report info ci-qemu-upstream-386 KASAN: slab-use-after-free Read in release_metapage
2023/04/30 12:39 upstream 825a0714d2b3 62df2017 .config console log report info ci-qemu-upstream-386 KASAN: slab-use-after-free Read in release_metapage
2023/04/30 11:39 upstream 825a0714d2b3 62df2017 .config console log report info ci-qemu-upstream-386 KASAN: slab-use-after-free Read in release_metapage
* Struck through repros no longer work on HEAD.