[moderation] [btrfs?] BUG: spinlock bad magic in btrfs_stop_all_workers

0 views
Skip to first unread message

syzbot

unread,
May 23, 2024, 5:20:34 PMMay 23
to syzkaller-upst...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: eb6a9339efeb Merge tag 'mm-nonmm-stable-2024-05-19-11-56' ..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=16d78768980000
kernel config: https://syzkaller.appspot.com/x/.config?x=e2ea586e11acd6ec
dashboard link: https://syzkaller.appspot.com/bug?extid=2cf55560fbd534a0cd2f
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
userspace arch: i386
CC: [c...@fb.com dst...@suse.com jo...@toxicpanda.com 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-eb6a9339.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/21782c1528d1/vmlinux-eb6a9339.xz
kernel image: https://storage.googleapis.com/syzbot-assets/6c377678e8b1/bzImage-eb6a9339.xz

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

BTRFS info (device loop1): last unmount of filesystem d552757d-9c39-40e3-95f0-16d819589928
BUG: spinlock bad magic on CPU#3, syz-executor.1/5234
==================================================================
BUG: KASAN: slab-out-of-bounds in task_pid_nr include/linux/pid.h:232 [inline]
BUG: KASAN: slab-out-of-bounds in spin_dump kernel/locking/spinlock_debug.c:64 [inline]
BUG: KASAN: slab-out-of-bounds in spin_bug+0x17d/0x1d0 kernel/locking/spinlock_debug.c:78
Read of size 4 at addr ffff888061a0e5d8 by task syz-executor.1/5234

CPU: 3 PID: 5234 Comm: syz-executor.1 Not tainted 6.9.0-syzkaller-09699-geb6a9339efeb #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+0xd9/0x110 mm/kasan/report.c:601
task_pid_nr include/linux/pid.h:232 [inline]
spin_dump kernel/locking/spinlock_debug.c:64 [inline]
spin_bug+0x17d/0x1d0 kernel/locking/spinlock_debug.c:78
debug_spin_lock_before kernel/locking/spinlock_debug.c:86 [inline]
do_raw_spin_lock+0x225/0x2c0 kernel/locking/spinlock_debug.c:115
put_pwq_unlocked kernel/workqueue.c:1662 [inline]
put_pwq_unlocked kernel/workqueue.c:1655 [inline]
destroy_workqueue+0x5df/0xaa0 kernel/workqueue.c:5851
btrfs_destroy_workqueue+0x41/0x260 fs/btrfs/async-thread.c:360
btrfs_stop_all_workers+0x1de/0x370 fs/btrfs/disk-io.c:1799
close_ctree+0x4e3/0xf90 fs/btrfs/disk-io.c:4365
generic_shutdown_super+0x159/0x3d0 fs/super.c:641
kill_anon_super+0x3a/0x60 fs/super.c:1225
btrfs_kill_super+0x3b/0x50 fs/btrfs/super.c:2088
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
RIP: 0023:0xf731f579
Code: b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 00 00 00 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00
RSP: 002b:00000000ff8da8e8 EFLAGS: 00000292 ORIG_RAX: 0000000000000034
RAX: 0000000000000000 RBX: 00000000ff8da990 RCX: 0000000000000009
RDX: 00000000f7475ff4 RSI: 00000000f73c6361 RDI: 00000000ff8dba34
RBP: 00000000ff8da990 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000292 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
</TASK>

Allocated by task 5687:
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:4121 [inline]
__kmalloc_noprof+0x1ec/0x420 mm/slub.c:4134
kmalloc_noprof include/linux/slab.h:664 [inline]
kzalloc_noprof include/linux/slab.h:778 [inline]
alloc_workqueue+0xe02/0x1ca0 kernel/workqueue.c:5667
btrfs_alloc_ordered_workqueue+0x1ed/0x4c0 fs/btrfs/async-thread.c:140
btrfs_init_workqueues fs/btrfs/disk-io.c:2018 [inline]
open_ctree+0x16a5/0x52e0 fs/btrfs/disk-io.c:3362
btrfs_fill_super fs/btrfs/super.c:938 [inline]
btrfs_get_tree_super fs/btrfs/super.c:1855 [inline]
btrfs_get_tree+0x11e9/0x1b90 fs/btrfs/super.c:2081
vfs_get_tree+0x8f/0x380 fs/super.c:1779
fc_mount+0x16/0xc0 fs/namespace.c:1125
btrfs_get_tree_subvol fs/btrfs/super.c:2044 [inline]
btrfs_get_tree+0xa53/0x1b90 fs/btrfs/super.c:2082
vfs_get_tree+0x8f/0x380 fs/super.c:1779
do_new_mount fs/namespace.c:3352 [inline]
path_mount+0x6e1/0x1f10 fs/namespace.c:3679
do_mount fs/namespace.c:3692 [inline]
__do_sys_mount fs/namespace.c:3898 [inline]
__se_sys_mount fs/namespace.c:3875 [inline]
__ia32_sys_mount+0x295/0x320 fs/namespace.c:3875
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

The buggy address belongs to the object at ffff888061a0e000
which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 960 bytes to the right of
allocated 536-byte region [ffff888061a0e000, ffff888061a0e218)

The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x61a08
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0x4fff00000000040(head|node=1|zone=1|lastcpupid=0x7ff)
page_type: 0xffffefff(slab)
raw: 04fff00000000040 ffff888015442dc0 ffffea0000690e00 0000000000000002
raw: 0000000000000000 0000000000100010 00000001ffffefff 0000000000000000
head: 04fff00000000040 ffff888015442dc0 ffffea0000690e00 0000000000000002
head: 0000000000000000 0000000000100010 00000001ffffefff 0000000000000000
head: 04fff00000000003 ffffea0001868201 ffffffffffffffff 0000000000000000
head: 0000000000000008 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0x152820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_HARDWALL), pid 1089, tgid 1089 (kworker/u32:6), ts 114416293980, free_ts 112556507042
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1468
prep_new_page mm/page_alloc.c:1476 [inline]
get_page_from_freelist+0x136a/0x2df0 mm/page_alloc.c:3402
__alloc_pages_noprof+0x22b/0x2460 mm/page_alloc.c:4660
__alloc_pages_node_noprof include/linux/gfp.h:244 [inline]
alloc_pages_node_noprof include/linux/gfp.h:271 [inline]
alloc_slab_page+0x56/0x110 mm/slub.c:2264
allocate_slab mm/slub.c:2427 [inline]
new_slab+0x84/0x260 mm/slub.c:2480
___slab_alloc+0xdac/0x1870 mm/slub.c:3666
__slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3756
__slab_alloc_node mm/slub.c:3809 [inline]
slab_alloc_node mm/slub.c:3988 [inline]
__do_kmalloc_node mm/slub.c:4120 [inline]
__kmalloc_noprof+0x37f/0x420 mm/slub.c:4134
kmalloc_noprof include/linux/slab.h:664 [inline]
kzalloc_noprof include/linux/slab.h:778 [inline]
ieee802_11_parse_elems_full+0xef/0x15b0 net/mac80211/parse.c:880
ieee802_11_parse_elems_crc net/mac80211/ieee80211_i.h:2330 [inline]
ieee802_11_parse_elems net/mac80211/ieee80211_i.h:2337 [inline]
ieee80211_rx_mgmt_probe_beacon net/mac80211/ibss.c:1574 [inline]
ieee80211_ibss_rx_queued_mgmt+0xc54/0x3030 net/mac80211/ibss.c:1605
ieee80211_iface_process_skb net/mac80211/iface.c:1605 [inline]
ieee80211_iface_work+0xc07/0xf00 net/mac80211/iface.c:1659
cfg80211_wiphy_work+0x255/0x330 net/wireless/core.c:437
process_one_work+0x958/0x1ad0 kernel/workqueue.c:3231
process_scheduled_works kernel/workqueue.c:3312 [inline]
worker_thread+0x6c8/0xf70 kernel/workqueue.c:3393
kthread+0x2c1/0x3a0 kernel/kthread.c:389
ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
page last free pid 5188 tgid 5188 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
free_pages_prepare mm/page_alloc.c:1088 [inline]
free_unref_page+0x64a/0xe40 mm/page_alloc.c:2565
__put_partials+0x14c/0x170 mm/slub.c:2994
qlink_free mm/kasan/quarantine.c:163 [inline]
qlist_free_all+0x4e/0x140 mm/kasan/quarantine.c:179
kasan_quarantine_reduce+0x192/0x1e0 mm/kasan/quarantine.c:286
__kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:322
kasan_slab_alloc include/linux/kasan.h:201 [inline]
slab_post_alloc_hook mm/slub.c:3940 [inline]
slab_alloc_node mm/slub.c:4000 [inline]
kmem_cache_alloc_node_noprof+0x153/0x310 mm/slub.c:4043
kmalloc_reserve+0x18b/0x2c0 net/core/skbuff.c:575
__alloc_skb+0x164/0x380 net/core/skbuff.c:666
alloc_skb_fclone include/linux/skbuff.h:1358 [inline]
tcp_stream_alloc_skb+0x34/0x570 net/ipv4/tcp.c:879
tcp_sendmsg_locked+0xecc/0x34c0 net/ipv4/tcp.c:1161
tcp_sendmsg+0x2e/0x50 net/ipv4/tcp.c:1348
inet_sendmsg+0xb9/0x140 net/ipv4/af_inet.c:851
sock_sendmsg_nosec net/socket.c:730 [inline]
__sock_sendmsg net/socket.c:745 [inline]
sock_write_iter+0x4b8/0x5c0 net/socket.c:1160
call_write_iter include/linux/fs.h:2120 [inline]
new_sync_write fs/read_write.c:497 [inline]
vfs_write+0x6b6/0x1120 fs/read_write.c:590
ksys_write+0x1f8/0x260 fs/read_write.c:643
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xcf/0x260 arch/x86/entry/common.c:83

Memory state around the buggy address:
ffff888061a0e480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888061a0e500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888061a0e580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff888061a0e600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888061a0e680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
----------------
Code disassembly (best guess), 2 bytes skipped:
0: 10 06 adc %al,(%rsi)
2: 03 74 b4 01 add 0x1(%rsp,%rsi,4),%esi
6: 10 07 adc %al,(%rdi)
8: 03 74 b0 01 add 0x1(%rax,%rsi,4),%esi
c: 10 08 adc %cl,(%rax)
e: 03 74 d8 01 add 0x1(%rax,%rbx,8),%esi
1e: 00 51 52 add %dl,0x52(%rcx)
21: 55 push %rbp
22: 89 e5 mov %esp,%ebp
24: 0f 34 sysenter
26: cd 80 int $0x80
* 28: 5d pop %rbp <-- trapping instruction
29: 5a pop %rdx
2a: 59 pop %rcx
2b: c3 ret
2c: 90 nop
2d: 90 nop
2e: 90 nop
2f: 90 nop
30: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi
37: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi


---
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 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
Reply all
Reply to author
Forward
0 new messages