[moderation] [hfs?] KASAN: slab-use-after-free Read in hfsplus_release_folio

7 views
Skip to first unread message

syzbot

unread,
Sep 22, 2023, 7:05:48 AM9/22/23
to syzkaller-upst...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: ce9ecca0238b Linux 6.6-rc2
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=140e7baa680000
kernel config: https://syzkaller.appspot.com/x/.config?x=d594086f139d167
dashboard link: https://syzkaller.appspot.com/bug?extid=06fbd4989c4bedfa8277
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
userspace arch: i386
CC: [linux-...@vger.kernel.org linux-...@vger.kernel.org]

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/7bc7510fe41f/non_bootable_disk-ce9ecca0.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/9f046a569d4b/vmlinux-ce9ecca0.xz
kernel image: https://storage.googleapis.com/syzbot-assets/be8e702bde71/bzImage-ce9ecca0.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+06fbd4...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: slab-use-after-free in instrument_atomic_read include/linux/instrumented.h:68 [inline]
BUG: KASAN: slab-use-after-free in atomic_read include/linux/atomic/atomic-instrumented.h:32 [inline]
BUG: KASAN: slab-use-after-free in hfsplus_release_folio+0x233/0x5f0 fs/hfsplus/inode.c:99
Read of size 4 at addr ffff888020176780 by task kswapd0/108

CPU: 0 PID: 108 Comm: kswapd0 Not tainted 6.6.0-rc2-syzkaller #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+0xd9/0x1b0 lib/dump_stack.c:106
print_address_description mm/kasan/report.c:364 [inline]
print_report+0xc4/0x620 mm/kasan/report.c:475
kasan_report+0xda/0x110 mm/kasan/report.c:588
check_region_inline mm/kasan/generic.c:181 [inline]
kasan_check_range+0xef/0x190 mm/kasan/generic.c:187
instrument_atomic_read include/linux/instrumented.h:68 [inline]
atomic_read include/linux/atomic/atomic-instrumented.h:32 [inline]
hfsplus_release_folio+0x233/0x5f0 fs/hfsplus/inode.c:99
filemap_release_folio+0x1f1/0x270 mm/filemap.c:4100
shrink_folio_list+0x2917/0x3e30 mm/vmscan.c:2068
evict_folios+0x6bf/0x1940 mm/vmscan.c:5195
try_to_shrink_lruvec+0x769/0xb00 mm/vmscan.c:5371
shrink_one+0x45f/0x700 mm/vmscan.c:5415
shrink_many mm/vmscan.c:5469 [inline]
lru_gen_shrink_node mm/vmscan.c:5586 [inline]
shrink_node+0x20d4/0x37a0 mm/vmscan.c:6526
kswapd_shrink_node mm/vmscan.c:7331 [inline]
balance_pgdat+0xa32/0x1b80 mm/vmscan.c:7521
kswapd+0x5be/0xbf0 mm/vmscan.c:7781
kthread+0x33c/0x440 kernel/kthread.c:388
ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304
</TASK>

Allocated by task 20759:
kasan_save_stack+0x33/0x50 mm/kasan/common.c:45
kasan_set_track+0x25/0x30 mm/kasan/common.c:52
____kasan_kmalloc mm/kasan/common.c:374 [inline]
__kasan_kmalloc+0xa2/0xb0 mm/kasan/common.c:383
kasan_kmalloc include/linux/kasan.h:198 [inline]
__do_kmalloc_node mm/slab_common.c:1023 [inline]
__kmalloc+0x60/0x100 mm/slab_common.c:1036
kmalloc include/linux/slab.h:603 [inline]
kzalloc include/linux/slab.h:720 [inline]
__hfs_bnode_create+0x108/0x860 fs/hfsplus/bnode.c:409
hfsplus_bnode_find+0x2c4/0xcb0 fs/hfsplus/bnode.c:486
hfsplus_brec_find+0x2b9/0x520 fs/hfsplus/bfind.c:183
hfsplus_brec_read+0x2d/0x120 fs/hfsplus/bfind.c:222
hfsplus_find_cat+0x1e6/0x4c0 fs/hfsplus/catalog.c:202
hfsplus_cat_write_inode+0x2bf/0x7e0 fs/hfsplus/inode.c:596
hfsplus_write_inode fs/hfsplus/super.c:160 [inline]
hfsplus_write_inode+0x91/0x4f0 fs/hfsplus/super.c:147
write_inode fs/fs-writeback.c:1456 [inline]
__writeback_single_inode+0xa81/0xe70 fs/fs-writeback.c:1668
writeback_sb_inodes+0x599/0x1010 fs/fs-writeback.c:1894
wb_writeback+0x2a5/0xa90 fs/fs-writeback.c:2070
wb_do_writeback fs/fs-writeback.c:2217 [inline]
wb_workfn+0x29c/0xfd0 fs/fs-writeback.c:2257
process_one_work+0x884/0x15c0 kernel/workqueue.c:2630
process_scheduled_works kernel/workqueue.c:2703 [inline]
worker_thread+0x8b9/0x1290 kernel/workqueue.c:2784
kthread+0x33c/0x440 kernel/kthread.c:388
ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304

Freed by task 4968:
kasan_save_stack+0x33/0x50 mm/kasan/common.c:45
kasan_set_track+0x25/0x30 mm/kasan/common.c:52
kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:522
____kasan_slab_free mm/kasan/common.c:236 [inline]
____kasan_slab_free+0x15b/0x1b0 mm/kasan/common.c:200
kasan_slab_free include/linux/kasan.h:164 [inline]
slab_free_hook mm/slub.c:1800 [inline]
slab_free_freelist_hook+0x114/0x1e0 mm/slub.c:1826
slab_free mm/slub.c:3809 [inline]
__kmem_cache_free+0xb8/0x2f0 mm/slub.c:3822
hfsplus_btree_close+0xac/0x390 fs/hfsplus/btree.c:275
hfsplus_put_super+0x24c/0x3f0 fs/hfsplus/super.c:301
generic_shutdown_super+0x161/0x3c0 fs/super.c:693
kill_block_super+0x3b/0x70 fs/super.c:1646
deactivate_locked_super+0x9a/0x170 fs/super.c:481
deactivate_super+0xde/0x100 fs/super.c:514
cleanup_mnt+0x222/0x3d0 fs/namespace.c:1254
task_work_run+0x14d/0x240 kernel/task_work.c:179
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
exit_to_user_mode_loop kernel/entry/common.c:171 [inline]
exit_to_user_mode_prepare+0x210/0x240 kernel/entry/common.c:204
__syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline]
syscall_exit_to_user_mode+0x1d/0x60 kernel/entry/common.c:296
__do_fast_syscall_32+0x6d/0xe0 arch/x86/entry/common.c:181
do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203
entry_SYSENTER_compat_after_hwframe+0x70/0x82

Last potentially related work creation:
kasan_save_stack+0x33/0x50 mm/kasan/common.c:45
__kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:492
insert_work+0x38/0x230 kernel/workqueue.c:1647
__queue_work+0x5d0/0x1050 kernel/workqueue.c:1799
queue_work_on+0xed/0x110 kernel/workqueue.c:1834
queue_work include/linux/workqueue.h:554 [inline]
addr_event.constprop.0+0x391/0x560 drivers/infiniband/core/roce_gid_mgmt.c:853
inetaddr_event+0xf0/0x140 drivers/infiniband/core/roce_gid_mgmt.c:869
notifier_call_chain+0xb6/0x3b0 kernel/notifier.c:93
blocking_notifier_call_chain kernel/notifier.c:388 [inline]
blocking_notifier_call_chain+0x69/0x90 kernel/notifier.c:376
__inet_insert_ifa+0x936/0xc20 net/ipv4/devinet.c:556
inet_rtm_newaddr+0x560/0xae0 net/ipv4/devinet.c:976
rtnetlink_rcv_msg+0x3c4/0xdf0 net/core/rtnetlink.c:6444
netlink_rcv_skb+0x16b/0x440 net/netlink/af_netlink.c:2545
netlink_unicast_kernel net/netlink/af_netlink.c:1342 [inline]
netlink_unicast+0x536/0x810 net/netlink/af_netlink.c:1368
netlink_sendmsg+0x93c/0xe40 net/netlink/af_netlink.c:1910
sock_sendmsg_nosec net/socket.c:730 [inline]
sock_sendmsg+0xd9/0x180 net/socket.c:753
__sys_sendto+0x255/0x340 net/socket.c:2177
__do_compat_sys_socketcall+0x5df/0x700 net/compat.c:475
do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline]
__do_fast_syscall_32+0x61/0xe0 arch/x86/entry/common.c:178
do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203
entry_SYSENTER_compat_after_hwframe+0x70/0x82

Second to last potentially related work creation:
kasan_save_stack+0x33/0x50 mm/kasan/common.c:45
__kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:492
kvfree_call_rcu+0x70/0xbe0 kernel/rcu/tree.c:3372
__put_watch_queue+0x1ab/0x230 kernel/watch_queue.c:401
kref_put include/linux/kref.h:65 [inline]
put_watch_queue+0x76/0xa0 kernel/watch_queue.c:410
free_pipe_info+0x275/0x3b0 fs/pipe.c:850
put_pipe_info fs/pipe.c:713 [inline]
pipe_release+0x2b2/0x310 fs/pipe.c:736
__fput+0x3f7/0xa70 fs/file_table.c:384
__fput_sync+0x47/0x50 fs/file_table.c:465
__do_sys_close fs/open.c:1572 [inline]
__se_sys_close fs/open.c:1557 [inline]
__ia32_sys_close+0x87/0xf0 fs/open.c:1557
do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline]
__do_fast_syscall_32+0x61/0xe0 arch/x86/entry/common.c:178
do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203
entry_SYSENTER_compat_after_hwframe+0x70/0x82

The buggy address belongs to the object at ffff888020176700
which belongs to the cache kmalloc-192 of size 192
The buggy address is located 128 bytes inside of
freed 192-byte region [ffff888020176700, ffff8880201767c0)

The buggy address belongs to the physical page:
page:ffffea0000805d80 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x20176
flags: 0xfff00000000800(slab|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000800 ffff888012c42a00 ffffea000078d680 dead000000000004
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 0x112c40(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY|__GFP_HARDWALL), pid 696, tgid 696 (syz-executor.1), ts 1360206833173, free_ts 1357200081994
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x2cf/0x340 mm/page_alloc.c:1536
prep_new_page mm/page_alloc.c:1543 [inline]
get_page_from_freelist+0xee0/0x2f20 mm/page_alloc.c:3170
__alloc_pages+0x1d0/0x4a0 mm/page_alloc.c:4426
__alloc_pages_node include/linux/gfp.h:237 [inline]
alloc_slab_page mm/slub.c:1872 [inline]
allocate_slab+0xa1/0x380 mm/slub.c:2017
new_slab mm/slub.c:2070 [inline]
___slab_alloc+0x8c7/0x1580 mm/slub.c:3223
__slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3322
__slab_alloc_node mm/slub.c:3375 [inline]
slab_alloc_node mm/slub.c:3468 [inline]
__kmem_cache_alloc_node+0x131/0x340 mm/slub.c:3517
__do_kmalloc_node mm/slab_common.c:1022 [inline]
__kmalloc_node+0x52/0x110 mm/slab_common.c:1030
kmalloc_array_node include/linux/slab.h:697 [inline]
kcalloc_node include/linux/slab.h:702 [inline]
memcg_alloc_slab_cgroups+0xa9/0x170 mm/memcontrol.c:2895
memcg_slab_post_alloc_hook+0xaa/0x390 mm/slab.h:530
slab_post_alloc_hook mm/slab.h:770 [inline]
slab_alloc_node mm/slub.c:3478 [inline]
slab_alloc mm/slub.c:3486 [inline]
__kmem_cache_alloc_lru mm/slub.c:3493 [inline]
kmem_cache_alloc+0x1a1/0x3b0 mm/slub.c:3502
kmem_cache_zalloc include/linux/slab.h:710 [inline]
alloc_buffer_head+0x21/0x140 fs/buffer.c:3011
folio_alloc_buffers+0x2e7/0x7f0 fs/buffer.c:935
folio_create_empty_buffers+0x36/0x470 fs/buffer.c:1648
ext4_block_write_begin+0xcc4/0xf10 fs/ext4/inode.c:1024
ext4_da_write_begin+0x40a/0x8c0 fs/ext4/inode.c:2890
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1136 [inline]
free_unref_page_prepare+0x476/0xa40 mm/page_alloc.c:2312
free_unref_page+0x33/0x3b0 mm/page_alloc.c:2405
kasan_depopulate_vmalloc_pte+0x63/0x80 mm/kasan/shadow.c:427
apply_to_pte_range mm/memory.c:2586 [inline]
apply_to_pmd_range mm/memory.c:2630 [inline]
apply_to_pud_range mm/memory.c:2666 [inline]
apply_to_p4d_range mm/memory.c:2702 [inline]
__apply_to_page_range+0x5ed/0xdb0 mm/memory.c:2736
kasan_release_vmalloc+0xa8/0xc0 mm/kasan/shadow.c:544
__purge_vmap_area_lazy+0x8b9/0x2160 mm/vmalloc.c:1770
drain_vmap_area_work+0x54/0xd0 mm/vmalloc.c:1804
process_one_work+0x884/0x15c0 kernel/workqueue.c:2630
process_scheduled_works kernel/workqueue.c:2703 [inline]
worker_thread+0x8b9/0x1290 kernel/workqueue.c:2784
kthread+0x33c/0x440 kernel/kthread.c:388
ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304

Memory state around the buggy address:
ffff888020176680: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff888020176700: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888020176780: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
^
ffff888020176800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888020176880: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the bug is already fixed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite bug's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the bug is a duplicate of another bug, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

syzbot

unread,
Dec 17, 2023, 5:59:17 AM12/17/23
to syzkaller-upst...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.
Reply all
Reply to author
Forward
0 new messages