[moderation] [kernel?] KASAN: slab-use-after-free Read in process_srcu

1 view
Skip to first unread message

syzbot

unread,
May 19, 2024, 10:53:19 PM (14 days ago) May 19
to syzkaller-upst...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 33e02dc69afb Merge tag 'sound-6.10-rc1' of git://git.kerne..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=17d66b5c980000
kernel config: https://syzkaller.appspot.com/x/.config?x=39878f1ce91ccfda
dashboard link: https://syzkaller.appspot.com/bug?extid=f44cfed96a2c671bc329
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
userspace arch: i386
CC: [b...@alien8.de dave....@linux.intel.com h...@zytor.com linux-...@vger.kernel.org mi...@redhat.com tg...@linutronix.de x...@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-33e02dc6.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/a7597d9cd2b5/vmlinux-33e02dc6.xz
kernel image: https://storage.googleapis.com/syzbot-assets/93cadb45c580/bzImage-33e02dc6.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+f44cfe...@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_long_read include/linux/atomic/atomic-instrumented.h:3188 [inline]
BUG: KASAN: slab-use-after-free in __mutex_unlock_slowpath+0xb0/0x650 kernel/locking/mutex.c:921
Read of size 8 at addr ffff8880272e1820 by task kworker/1:2/1765

CPU: 1 PID: 1765 Comm: kworker/1:2 Not tainted 6.9.0-syzkaller-07370-g33e02dc69afb #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
Workqueue: rcu_gp process_srcu
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
check_region_inline mm/kasan/generic.c:183 [inline]
kasan_check_range+0xef/0x1a0 mm/kasan/generic.c:189
instrument_atomic_read include/linux/instrumented.h:68 [inline]
atomic_long_read include/linux/atomic/atomic-instrumented.h:3188 [inline]
__mutex_unlock_slowpath+0xb0/0x650 kernel/locking/mutex.c:921
srcu_gp_end kernel/rcu/srcutree.c:919 [inline]
srcu_advance_state kernel/rcu/srcutree.c:1707 [inline]
process_srcu+0xe46/0x1730 kernel/rcu/srcutree.c:1811
process_one_work+0x902/0x1a30 kernel/workqueue.c:3267
process_scheduled_works kernel/workqueue.c:3348 [inline]
worker_thread+0x6c8/0xf70 kernel/workqueue.c:3429
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 8075:
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
kmalloc include/linux/slab.h:628 [inline]
kzalloc include/linux/slab.h:749 [inline]
init_srcu_struct_fields+0x8ec/0xd90 kernel/rcu/srcutree.c:240
bch2_fs_btree_iter_init+0xf6/0x160 fs/bcachefs/btree_iter.c:3312
bch2_fs_alloc+0x1a2f/0x25c0 fs/bcachefs/super.c:925
bch2_fs_open+0x713/0x10f0 fs/bcachefs/super.c:2084
bch2_mount+0xd41/0x1090 fs/bcachefs/fs.c:1906
legacy_get_tree+0x109/0x220 fs/fs_context.c:662
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

Freed by task 7299:
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
cleanup_srcu_struct+0x322/0x520 kernel/rcu/srcutree.c:678
bch2_fs_btree_iter_exit+0x46e/0x630 fs/bcachefs/btree_iter.c:3279
__bch2_fs_free fs/bcachefs/super.c:562 [inline]
bch2_fs_release+0xfb/0x670 fs/bcachefs/super.c:610
kobject_cleanup lib/kobject.c:689 [inline]
kobject_release lib/kobject.c:720 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x1fa/0x5b0 lib/kobject.c:737
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

Last potentially related work creation:
kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
__kasan_record_aux_stack+0xba/0xd0 mm/kasan/generic.c:541
insert_work+0x36/0x230 kernel/workqueue.c:2261
__queue_work+0x944/0x1020 kernel/workqueue.c:2413
__queue_delayed_work+0x21b/0x2e0 kernel/workqueue.c:2564
queue_delayed_work_on+0x10e/0x130 kernel/workqueue.c:2608
srcu_gp_end kernel/rcu/srcutree.c:928 [inline]
srcu_advance_state kernel/rcu/srcutree.c:1707 [inline]
process_srcu+0x119a/0x1730 kernel/rcu/srcutree.c:1811
process_one_work+0x902/0x1a30 kernel/workqueue.c:3267
process_scheduled_works kernel/workqueue.c:3348 [inline]
worker_thread+0x6c8/0xf70 kernel/workqueue.c:3429
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

Second to last potentially related work creation:
kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
__kasan_record_aux_stack+0xba/0xd0 mm/kasan/generic.c:541
insert_work+0x36/0x230 kernel/workqueue.c:2261
__queue_work+0x944/0x1020 kernel/workqueue.c:2413
call_timer_fn+0x1a0/0x610 kernel/time/timer.c:1793
expire_timers kernel/time/timer.c:1839 [inline]
__run_timers+0x567/0xaf0 kernel/time/timer.c:2418
__run_timer_base kernel/time/timer.c:2429 [inline]
__run_timer_base kernel/time/timer.c:2422 [inline]
run_timer_base+0x111/0x190 kernel/time/timer.c:2438
run_timer_softirq+0x1a/0x40 kernel/time/timer.c:2448
handle_softirqs+0x216/0x8f0 kernel/softirq.c:554
__do_softirq kernel/softirq.c:588 [inline]
invoke_softirq kernel/softirq.c:428 [inline]
__irq_exit_rcu kernel/softirq.c:637 [inline]
irq_exit_rcu+0xbb/0x120 kernel/softirq.c:649
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1043 [inline]
sysvec_apic_timer_interrupt+0x95/0xb0 arch/x86/kernel/apic/apic.c:1043
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702

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

The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x272e0
head: order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0
anon flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000840 ffff888015442dc0 0000000000000000 dead000000000001
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
head: 00fff00000000840 ffff888015442dc0 0000000000000000 dead000000000001
head: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
head: 00fff00000000003 ffffea00009cb801 dead000000000122 00000000ffffffff
head: 0000000800000000 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 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5235, tgid 5235 (syz-executor.3), ts 50372400329, free_ts 50337495478
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_node include/linux/slab.h:648 [inline]
kzalloc_node include/linux/slab.h:760 [inline]
qdisc_alloc+0xb3/0xbd0 net/sched/sch_generic.c:944
qdisc_create_dflt+0x73/0x440 net/sched/sch_generic.c:1006
attach_one_default_qdisc net/sched/sch_generic.c:1172 [inline]
netdev_for_each_tx_queue include/linux/netdevice.h:2504 [inline]
attach_default_qdiscs net/sched/sch_generic.c:1190 [inline]
dev_activate+0x667/0x1310 net/sched/sch_generic.c:1249
__dev_open+0x396/0x4e0 net/core/dev.c:1481
__dev_change_flags+0x561/0x720 net/core/dev.c:8780
dev_change_flags+0x8f/0x160 net/core/dev.c:8852
do_setlink+0x19a6/0x3ea0 net/core/rtnetlink.c:2900
__rtnl_newlink+0xc3a/0x1960 net/core/rtnetlink.c:3696
rtnl_newlink+0x67/0xa0 net/core/rtnetlink.c:3743
page last free pid 5266 tgid 5266 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
__put_partials+0x14c/0x170 mm/slub.c:2920
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:3871 [inline]
slab_alloc_node mm/slub.c:3918 [inline]
__do_kmalloc_node mm/slub.c:4038 [inline]
__kmalloc+0x1bd/0x440 mm/slub.c:4052
kmalloc include/linux/slab.h:632 [inline]
kzalloc include/linux/slab.h:749 [inline]
fib6_info_alloc+0x40/0x160 net/ipv6/ip6_fib.c:155
ip6_route_info_create+0x337/0x1ae0 net/ipv6/route.c:3759
ip6_route_add+0x26/0x190 net/ipv6/route.c:3851
addrconf_add_mroute+0x1de/0x350 net/ipv6/addrconf.c:2549
addrconf_add_dev+0x14e/0x1c0 net/ipv6/addrconf.c:2567
addrconf_dev_config net/ipv6/addrconf.c:3481 [inline]
addrconf_init_auto_addrs+0x380/0x820 net/ipv6/addrconf.c:3569
addrconf_notify+0x6ef/0x19e0 net/ipv6/addrconf.c:3742
notifier_call_chain+0xb9/0x410 kernel/notifier.c:93
call_netdevice_notifiers_info+0xbe/0x140 net/core/dev.c:1992

Memory state around the buggy address:
ffff8880272e1700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8880272e1780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8880272e1800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880272e1880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880272e1900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
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