syzbot


KASAN: invalid-free in hfs_release_folio (2)

Status: auto-obsoleted due to no activity on 2024/08/24 13:29
Subsystems: hfs
[Documentation on labels]
Reported-by: syzbot+be88fd56f9769df61aee@syzkaller.appspotmail.com
First crash: 278d, last: 177d
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [hfs?] KASAN: invalid-free in hfs_release_folio (2) 0 (1) 2024/02/05 09:01
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: invalid-free in hfs_release_folio hfs 13 441d 616d 0/28 auto-obsoleted due to no activity on 2023/12/04 08:11

Sample crash report:
==================================================================
BUG: KASAN: double-free in hfs_release_folio+0x435/0x570 fs/hfs/inode.c:118
Free of addr ffff88801bf9f500 by task kswapd0/111

CPU: 1 PID: 111 Comm: kswapd0 Not tainted 6.9.0-syzkaller-07726-g3c999d1ae3c7 #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:114
 print_address_description mm/kasan/report.c:377 [inline]
 print_report+0xc3/0x620 mm/kasan/report.c:488
 kasan_report_invalid_free+0xaa/0xd0 mm/kasan/report.c:563
 poison_slab_object mm/kasan/common.c:232 [inline]
 __kasan_slab_free+0x16b/0x1a0 mm/kasan/common.c:256
 kasan_slab_free include/linux/kasan.h:184 [inline]
 slab_free_hook mm/slub.c:2121 [inline]
 slab_free mm/slub.c:4353 [inline]
 kfree+0x129/0x3a0 mm/slub.c:4463
 hfs_release_folio+0x435/0x570 fs/hfs/inode.c:118
 filemap_release_folio+0x1ed/0x280 mm/filemap.c:4132
 shrink_folio_list+0x295a/0x3f00 mm/vmscan.c:1376
 evict_folios+0x6e6/0x1bb0 mm/vmscan.c:4537
 try_to_shrink_lruvec+0x618/0x9b0 mm/vmscan.c:4733
 shrink_one+0x3f8/0x7c0 mm/vmscan.c:4772
 shrink_many mm/vmscan.c:4835 [inline]
 lru_gen_shrink_node+0x89f/0x1750 mm/vmscan.c:4935
 shrink_node mm/vmscan.c:5894 [inline]
 kswapd_shrink_node mm/vmscan.c:6704 [inline]
 balance_pgdat+0x10d1/0x1a10 mm/vmscan.c:6895
 kswapd+0x5ea/0xbf0 mm/vmscan.c:7164
 kthread+0x2c1/0x3a0 kernel/kthread.c:389
 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
 </TASK>

Allocated by task 11675:
 kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
 kasan_save_track+0x14/0x30 mm/kasan/common.c:68
 poison_kmalloc_redzone mm/kasan/common.c:370 [inline]
 __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:387
 kasan_kmalloc include/linux/kasan.h:211 [inline]
 __do_kmalloc_node mm/slub.c:4039 [inline]
 __kmalloc+0x1f9/0x440 mm/slub.c:4052
 kmalloc include/linux/slab.h:632 [inline]
 kzalloc include/linux/slab.h:749 [inline]
 __hfs_bnode_create+0x108/0x860 fs/hfs/bnode.c:259
 hfs_bnode_find+0x2d1/0xc50 fs/hfs/bnode.c:335
 hfs_brec_find+0x2af/0x510 fs/hfs/bfind.c:126
 hfs_brec_read+0x26/0x120 fs/hfs/bfind.c:165
 hfs_lookup+0x209/0x320 fs/hfs/dir.c:32
 lookup_open.isra.0+0x928/0x13c0 fs/namei.c:3483
 open_last_lookups fs/namei.c:3574 [inline]
 path_openat+0x92f/0x2990 fs/namei.c:3804
 do_filp_open+0x1dc/0x430 fs/namei.c:3834
 do_sys_openat2+0x17a/0x1e0 fs/open.c:1406
 do_sys_open fs/open.c:1421 [inline]
 __do_compat_sys_openat fs/open.c:1481 [inline]
 __se_compat_sys_openat fs/open.c:1479 [inline]
 __ia32_compat_sys_openat+0x16e/0x210 fs/open.c:1479
 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline]
 __do_fast_syscall_32+0x75/0x120 arch/x86/entry/common.c:386
 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411
 entry_SYSENTER_compat_after_hwframe+0x84/0x8e

Freed by task 5229:
 kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
 kasan_save_track+0x14/0x30 mm/kasan/common.c:68
 kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:579
 poison_slab_object mm/kasan/common.c:240 [inline]
 __kasan_slab_free+0x11d/0x1a0 mm/kasan/common.c:256
 kasan_slab_free include/linux/kasan.h:184 [inline]
 slab_free_hook mm/slub.c:2121 [inline]
 slab_free mm/slub.c:4353 [inline]
 kfree+0x129/0x3a0 mm/slub.c:4463
 hfs_btree_close+0xac/0x390 fs/hfs/btree.c:154
 hfs_mdb_put+0xbf/0x380 fs/hfs/mdb.c:360
 generic_shutdown_super+0x159/0x3d0 fs/super.c:641
 kill_block_super+0x3b/0x90 fs/super.c:1675
 deactivate_locked_super+0xbe/0x1a0 fs/super.c:472
 deactivate_super+0xde/0x100 fs/super.c:505
 cleanup_mnt+0x222/0x450 fs/namespace.c:1267
 task_work_run+0x14e/0x250 kernel/task_work.c:180
 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:114 [inline]
 exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline]
 __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline]
 syscall_exit_to_user_mode+0x278/0x2a0 kernel/entry/common.c:218
 __do_fast_syscall_32+0x82/0x120 arch/x86/entry/common.c:389
 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411
 entry_SYSENTER_compat_after_hwframe+0x84/0x8e

The buggy address belongs to the object at ffff88801bf9f500
 which belongs to the cache kmalloc-192 of size 192
The buggy address is located 0 bytes inside of
 192-byte region [ffff88801bf9f500, ffff88801bf9f5c0)

The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1bf9f
ksm flags: 0xfff00000000800(slab|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000800 ffff8880154423c0 ffffea0000897bc0 dead000000000003
raw: 0000000000000000 0000000000100010 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 0x352800(GFP_NOWAIT|__GFP_NORETRY|__GFP_COMP|__GFP_HARDWALL|__GFP_THISNODE), pid 5891, tgid 5890 (syz-executor.1), ts 78397646200, free_ts 78387413751
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x2d4/0x350 mm/page_alloc.c:1534
 prep_new_page mm/page_alloc.c:1541 [inline]
 get_page_from_freelist+0xa28/0x3780 mm/page_alloc.c:3317
 __alloc_pages+0x22b/0x2460 mm/page_alloc.c:4575
 __alloc_pages_node include/linux/gfp.h:238 [inline]
 alloc_pages_node include/linux/gfp.h:261 [inline]
 alloc_slab_page mm/slub.c:2190 [inline]
 allocate_slab mm/slub.c:2353 [inline]
 new_slab+0xcc/0x3a0 mm/slub.c:2406
 ___slab_alloc+0xd28/0x1810 mm/slub.c:3592
 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3682
 __slab_alloc_node mm/slub.c:3735 [inline]
 slab_alloc_node mm/slub.c:3908 [inline]
 __do_kmalloc_node mm/slub.c:4038 [inline]
 __kmalloc_node+0x379/0x480 mm/slub.c:4046
 kmalloc_array_node include/linux/slab.h:726 [inline]
 kcalloc_node include/linux/slab.h:731 [inline]
 memcg_alloc_slab_cgroups+0xa9/0x180 mm/memcontrol.c:3015
 __memcg_slab_post_alloc_hook+0xa3/0x370 mm/slub.c:1970
 memcg_slab_post_alloc_hook mm/slub.c:1993 [inline]
 slab_post_alloc_hook mm/slub.c:3880 [inline]
 slab_alloc_node mm/slub.c:3918 [inline]
 kmem_cache_alloc+0x31a/0x330 mm/slub.c:3925
 kmem_cache_zalloc include/linux/slab.h:739 [inline]
 alloc_buffer_head+0x21/0x160 fs/buffer.c:3001
 folio_alloc_buffers+0x2c8/0x7d0 fs/buffer.c:924
 grow_dev_folio fs/buffer.c:1067 [inline]
 grow_buffers fs/buffer.c:1108 [inline]
 __getblk_slow+0x27c/0x6a0 fs/buffer.c:1134
 bdev_getblk+0xb1/0xc0 fs/buffer.c:1429
 __bread_gfp+0xa9/0x370 fs/buffer.c:1474
 sb_bread include/linux/buffer_head.h:321 [inline]
 fat_fill_super+0x39d/0x3d00 fs/fat/inode.c:1654
page last free pid 5891 tgid 5890 stack trace:
 reset_page_owner include/linux/page_owner.h:25 [inline]
 free_pages_prepare mm/page_alloc.c:1141 [inline]
 free_unref_page_prepare+0x527/0xb10 mm/page_alloc.c:2347
 free_unref_page+0x33/0x3c0 mm/page_alloc.c:2487
 tlb_batch_list_free mm/mmu_gather.c:159 [inline]
 tlb_finish_mmu+0x237/0x7b0 mm/mmu_gather.c:468
 unmap_region+0x342/0x420 mm/mmap.c:2317
 do_vmi_align_munmap+0x11b3/0x1ad0 mm/mmap.c:2630
 do_vmi_munmap+0x20b/0x450 mm/mmap.c:2698
 __vm_munmap+0x145/0x3a0 mm/mmap.c:2974
 __do_sys_munmap mm/mmap.c:2991 [inline]
 __se_sys_munmap mm/mmap.c:2988 [inline]
 __ia32_sys_munmap+0x5f/0x90 mm/mmap.c:2988
 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline]
 __do_fast_syscall_32+0x75/0x120 arch/x86/entry/common.c:386
 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411
 entry_SYSENTER_compat_after_hwframe+0x84/0x8e

Memory state around the buggy address:
 ffff88801bf9f400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88801bf9f480: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff88801bf9f500: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff88801bf9f580: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff88801bf9f600: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/05/16 13:28 upstream 3c999d1ae3c7 ef5d53ed .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: invalid-free in hfs_release_folio
2024/03/09 20:29 upstream 09e5c48fea17 6ee49f2e .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: invalid-free in hfs_release_folio
2024/02/26 02:10 upstream 70ff1fe626a1 8d446f15 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: invalid-free in hfs_release_folio
2024/02/05 06:57 upstream 54be6c6c5ae8 a67b2c42 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: invalid-free in hfs_release_folio
* Struck through repros no longer work on HEAD.