[syzbot] [bcachefs?] WARNING in rhashtable_init_noprof

3 views
Skip to first unread message

syzbot

unread,
May 26, 2025, 4:50:31 AM5/26/25
to kent.ov...@linux.dev, linux-b...@vger.kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 176e917e010c Add linux-next specific files for 20250523
git tree: linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=13d555f4580000
kernel config: https://syzkaller.appspot.com/x/.config?x=e7902c752bef748
dashboard link: https://syzkaller.appspot.com/bug?extid=bcc38a9556d0324c2ec2
compiler: Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=145948e8580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13d6a170580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/5f7692c642fa/disk-176e917e.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/057a442d42d0/vmlinux-176e917e.xz
kernel image: https://storage.googleapis.com/syzbot-assets/8f8ebdb4dd96/bzImage-176e917e.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/d3d310848021/mount_0.gz

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

ODEBUG: object ffffc9000469fb90 is on stack ffffc90004698000, but NOT annotated.
------------[ cut here ]------------
WARNING: CPU: 1 PID: 5924 at lib/debugobjects.c:655 debug_object_is_on_stack lib/debugobjects.c:655 [inline]
WARNING: CPU: 1 PID: 5924 at lib/debugobjects.c:655 lookup_object_or_alloc lib/debugobjects.c:688 [inline]
WARNING: CPU: 1 PID: 5924 at lib/debugobjects.c:655 __debug_object_init+0x2c9/0x3c0 lib/debugobjects.c:743
Modules linked in:
CPU: 1 UID: 0 PID: 5924 Comm: bch-copygc/loop Not tainted 6.15.0-rc7-next-20250523-syzkaller #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
RIP: 0010:debug_object_is_on_stack lib/debugobjects.c:655 [inline]
RIP: 0010:lookup_object_or_alloc lib/debugobjects.c:688 [inline]
RIP: 0010:__debug_object_init+0x2c9/0x3c0 lib/debugobjects.c:743
Code: cc cc cc 41 ff c7 44 89 3d a4 18 14 15 48 c7 c1 80 9b e2 8b 48 c7 c7 e0 9b e2 8b 84 c0 48 0f 45 f9 48 89 de e8 48 2b 61 fc 90 <0f> 0b 90 e9 c0 fe ff ff e8 3a 1c 00 00 8b 05 1c 9c c6 09 3b 05 1a
RSP: 0018:ffffc9000469f6e0 EFLAGS: 00010046
RAX: 0000000000000050 RBX: ffffc9000469fb90 RCX: 0aa01120dfd08500
RDX: 0000000000000000 RSI: 0000000080000001 RDI: 0000000000000000
RBP: ffff88802f5c9e20 R08: ffffc9000469f3c7 R09: 1ffff920008d3e78
R10: dffffc0000000000 R11: fffff520008d3e79 R12: 0000000000000040
R13: ffff8880771e5d20 R14: dffffc0000000000 R15: 0000000000000001
FS: 0000000000000000(0000) GS:ffff888125d56000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f1c5ee80000 CR3: 0000000077540000 CR4: 00000000003526f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
rhashtable_init_noprof+0x7c0/0xbb0 lib/rhashtable.c:1085
bch2_copygc_thread+0x116/0xdc0 fs/bcachefs/movinggc.c:355
kthread+0x711/0x8a0 kernel/kthread.c:464
ret_from_fork+0x3fc/0x770 arch/x86/kernel/process.c:148
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
</TASK>


---
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 report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

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

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

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

Alan Huang

unread,
May 26, 2025, 6:41:26 AM5/26/25
to syzbot, kent.ov...@linux.dev, linux-b...@vger.kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com
#syz test: https://github.com/alanskind/bcachefs 9b38df1f0d770aef29fd6aea023b28b053e14ecf

syzbot

unread,
May 26, 2025, 7:13:07 AM5/26/25
to kent.ov...@linux.dev, linux-b...@vger.kernel.org, linux-...@vger.kernel.org, mmpgo...@gmail.com, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
KASAN: slab-use-after-free Read in rhashtable_free_and_destroy

==================================================================
BUG: KASAN: slab-use-after-free in rhashtable_free_and_destroy+0x7d7/0x940 lib/rhashtable.c:1172
Read of size 8 at addr ffff8880294ab830 by task bch-copygc/loop/7051

CPU: 0 UID: 0 PID: 7051 Comm: bch-copygc/loop Not tainted 6.15.0-rc4-syzkaller-00272-g9b38df1f0d77 #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Call Trace:
<TASK>
dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
print_address_description mm/kasan/report.c:408 [inline]
print_report+0xd2/0x2b0 mm/kasan/report.c:521
kasan_report+0x118/0x150 mm/kasan/report.c:634
rhashtable_free_and_destroy+0x7d7/0x940 lib/rhashtable.c:1172
bch2_copygc_thread+0xc69/0xd40 fs/bcachefs/movinggc.c:427
kthread+0x70e/0x8a0 kernel/kthread.c:464
ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:153
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
</TASK>

Allocated by task 7051:
kasan_save_stack mm/kasan/common.c:47 [inline]
kasan_save_track+0x3e/0x80 mm/kasan/common.c:68
poison_kmalloc_redzone mm/kasan/common.c:377 [inline]
__kasan_kmalloc+0x93/0xb0 mm/kasan/common.c:394
kasan_kmalloc include/linux/kasan.h:260 [inline]
__do_kmalloc_node mm/slub.c:4341 [inline]
__kvmalloc_node_noprof+0x314/0x600 mm/slub.c:5026
bucket_table_alloc lib/rhashtable.c:186 [inline]
rhashtable_init_noprof+0x4ee/0xbb0 lib/rhashtable.c:1075
bch2_copygc_thread+0xb7/0xd40 fs/bcachefs/movinggc.c:356
kthread+0x70e/0x8a0 kernel/kthread.c:464
ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:153
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245

Freed by task 7048:
kasan_save_stack mm/kasan/common.c:47 [inline]
kasan_save_track+0x3e/0x80 mm/kasan/common.c:68
kasan_save_free_info+0x46/0x50 mm/kasan/generic.c:576
poison_slab_object mm/kasan/common.c:247 [inline]
__kasan_slab_free+0x62/0x70 mm/kasan/common.c:264
kasan_slab_free include/linux/kasan.h:233 [inline]
slab_free_hook mm/slub.c:2398 [inline]
slab_free mm/slub.c:4656 [inline]
kfree+0x18e/0x440 mm/slub.c:4855
rhashtable_free_and_destroy+0x7e8/0x940 lib/rhashtable.c:1173
bch2_copygc_thread+0xc69/0xd40 fs/bcachefs/movinggc.c:427
kthread+0x70e/0x8a0 kernel/kthread.c:464
ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:153
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245

The buggy address belongs to the object at ffff8880294ab800
which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 48 bytes inside of
freed 1024-byte region [ffff8880294ab800, ffff8880294abc00)

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x294a8
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 00fff00000000040 ffff88801a041dc0 dead000000000122 0000000000000000
raw: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000
head: 00fff00000000040 ffff88801a041dc0 dead000000000122 0000000000000000
head: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000
head: 00fff00000000003 ffffea0000a52a01 00000000ffffffff 00000000ffffffff
head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 6998, tgid 6996 (syz.4.25), ts 143611566388, free_ts 143543501461
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x240/0x2a0 mm/page_alloc.c:1718
prep_new_page mm/page_alloc.c:1726 [inline]
get_page_from_freelist+0x21ce/0x22b0 mm/page_alloc.c:3688
__alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:4970
alloc_pages_mpol+0x232/0x4a0 mm/mempolicy.c:2301
alloc_slab_page mm/slub.c:2468 [inline]
allocate_slab+0x8a/0x3b0 mm/slub.c:2632
new_slab mm/slub.c:2686 [inline]
___slab_alloc+0xbfc/0x1480 mm/slub.c:3872
__slab_alloc mm/slub.c:3962 [inline]
__slab_alloc_node mm/slub.c:4037 [inline]
slab_alloc_node mm/slub.c:4198 [inline]
__do_kmalloc_node mm/slub.c:4340 [inline]
__kmalloc_noprof+0x305/0x4f0 mm/slub.c:4353
kmalloc_noprof include/linux/slab.h:909 [inline]
kzalloc_noprof include/linux/slab.h:1039 [inline]
__alloc_workqueue+0x103/0x1b70 kernel/workqueue.c:5683
alloc_workqueue+0xd4/0x210 kernel/workqueue.c:5786
bch2_fs_journal_init+0x2dc/0x4d0 fs/bcachefs/journal.c:1648
bch2_fs_init_rw fs/bcachefs/super.c:830 [inline]
__bch2_fs_read_write+0x837/0x880 fs/bcachefs/super.c:500
bch2_fs_read_write_early+0x26/0x40 fs/bcachefs/super.c:588
bch2_run_recovery_pass fs/bcachefs/recovery_passes.c:415 [inline]
__bch2_run_recovery_passes+0x391/0x1110 fs/bcachefs/recovery_passes.c:470
bch2_run_recovery_passes+0x184/0x210 fs/bcachefs/recovery_passes.c:541
bch2_fs_recovery+0x2617/0x3970 fs/bcachefs/recovery.c:974
bch2_fs_start+0xa43/0xd30 fs/bcachefs/super.c:1206
page last free pid 7040 tgid 7040 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
free_pages_prepare mm/page_alloc.c:1262 [inline]
__free_frozen_pages+0xc68/0xe50 mm/page_alloc.c:2725
discard_slab mm/slub.c:2730 [inline]
__put_partials+0x161/0x1c0 mm/slub.c:3199
put_cpu_partial+0x17c/0x250 mm/slub.c:3274
__slab_free+0x2f7/0x400 mm/slub.c:4526
qlink_free mm/kasan/quarantine.c:163 [inline]
qlist_free_all+0x97/0x140 mm/kasan/quarantine.c:179
kasan_quarantine_reduce+0x148/0x160 mm/kasan/quarantine.c:286
__kasan_slab_alloc+0x22/0x80 mm/kasan/common.c:329
kasan_slab_alloc include/linux/kasan.h:250 [inline]
slab_post_alloc_hook mm/slub.c:4161 [inline]
slab_alloc_node mm/slub.c:4210 [inline]
kmem_cache_alloc_noprof+0x1c1/0x3c0 mm/slub.c:4217
vm_area_alloc+0x24/0x140 kernel/fork.c:441
__mmap_new_vma mm/vma.c:2402 [inline]
__mmap_region mm/vma.c:2519 [inline]
mmap_region+0xcf4/0x1e50 mm/vma.c:2597
do_mmap+0xc68/0x1100 mm/mmap.c:561
vm_mmap_pgoff+0x31b/0x4c0 mm/util.c:579
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xf6/0x220 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f

Memory state around the buggy address:
ffff8880294ab700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8880294ab780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8880294ab800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880294ab880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880294ab900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


Tested on:

commit: 9b38df1f bcachefs: Don't allocate buckets_in_flight on..
git tree: https://github.com/alanskind/bcachefs
console output: https://syzkaller.appspot.com/x/log.txt?x=17cdbad4580000
kernel config: https://syzkaller.appspot.com/x/.config?x=96ae50edd782e9ea
dashboard link: https://syzkaller.appspot.com/bug?extid=bcc38a9556d0324c2ec2
compiler: Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6

Note: no patches were applied.

syzbot

unread,
May 27, 2025, 8:11:06 AM5/27/25
to ak...@linux-foundation.org, guoweika...@gmail.com, kent.ov...@linux.dev, kps...@kernel.org, linux-b...@vger.kernel.org, linux-...@vger.kernel.org, mmpgo...@gmail.com, pau...@kernel.org, pml...@suse.com, rra...@chromium.org, syzkall...@googlegroups.com, ure...@gmail.com, vba...@suse.cz
syzbot has bisected this issue to:

commit 82067c916994dd1bfec65496144dc16e17899e36
Author: Kent Overstreet <kent.ov...@linux.dev>
Date: Fri May 9 03:21:28 2025 +0000

bcachefs: buckets_in_flight on stack

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=1528f882580000
start commit: 176e917e010c Add linux-next specific files for 20250523
git tree: linux-next
final oops: https://syzkaller.appspot.com/x/report.txt?x=1728f882580000
console output: https://syzkaller.appspot.com/x/log.txt?x=1328f882580000
Reported-by: syzbot+bcc38a...@syzkaller.appspotmail.com
Fixes: 82067c916994 ("bcachefs: buckets_in_flight on stack")

For information about bisection process see: https://goo.gl/tpsmEJ#bisection

syzbot

unread,
Jun 8, 2025, 11:41:17 AM6/8/25
to linux-...@vger.kernel.org, syzkall...@googlegroups.com
For archival purposes, forwarding an incoming command email to
linux-...@vger.kernel.org, syzkall...@googlegroups.com.

***

Subject:
Author: kent.ov...@linux.dev

#syz fix: bcachefs: Don't put rhashtable on stack
Reply all
Reply to author
Forward
0 new messages