Linux6.14-rc5 Bug: KASAN: invalid-free in delayed_free

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello, I found a bug titled " KASAN: invalid-free in delayed_free  " with modified syzkaller in the Linux6.14-rc5.
If you fix this issue, please add the following tag to the commit:  Reported-by: Jianzhou Zhao <xnxc22xnxc22@xxxxxx>,    xingwei lee <xrivendell7@xxxxxxxxx>, Zhizhuo Tang <strforexctzzchange@xxxxxxxxxxx>

I use the same kernel as syzbot instance upstream: 7eb172143d5508b4da468ed59ee857c6e5e01da6
kernel config: https://syzkaller.appspot.com/text?tag=KernelConfig&amp;x=da4b04ae798b7ef6
compiler: gcc version 11.4.0
------------[ cut here ]-----------------------------------------
 TITLE:    KASAN: invalid-free in delayed_free 
==================================================================
==================================================================
BUG: KASAN: double-free in kvfree+0x46/0x50 mm/util.c:705
Free of addr ffff8880295c0000 by task systemd-udevd/13199

CPU: 1 UID: 0 PID: 13199 Comm: systemd-udevd Not tainted 6.14.0-rc5-dirty #17
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
Call Trace:
 <task>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x116/0x1b0 lib/dump_stack.c:120
 print_address_description mm/kasan/report.c:408 [inline]
 print_report+0xc1/0x630 mm/kasan/report.c:521
 kasan_report_invalid_free+0x73/0x90 mm/kasan/report.c:596
 check_slab_allocation+0x104/0x140 mm/kasan/common.c:225
 kasan_slab_pre_free include/linux/kasan.h:198 [inline]
 slab_free_hook mm/slub.c:2298 [inline]
 slab_free mm/slub.c:4609 [inline]
 kfree+0x11b/0x450 mm/slub.c:4757
 kvfree+0x46/0x50 mm/util.c:705
 delayed_free+0x49/0xb0 fs/exfat/super.c:809
 rcu_do_batch kernel/rcu/tree.c:2546 [inline]
 rcu_core+0x7c2/0x16b0 kernel/rcu/tree.c:2802
 handle_softirqs+0x1c1/0x8a0 kernel/softirq.c:561
 __do_softirq kernel/softirq.c:595 [inline]
 invoke_softirq kernel/softirq.c:435 [inline]
 __irq_exit_rcu kernel/softirq.c:662 [inline]
 irq_exit_rcu+0xfd/0x150 kernel/softirq.c:678
 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1049 [inline]
 sysvec_apic_timer_interrupt+0x59/0xc0 arch/x86/kernel/apic/apic.c:1049
 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702
RIP: 0033:0x7fc58cae77d9
Code: 6a 85 c9 0f 84 5b ff ff ff f3 0f 6f 06 e9 52 ff ff ff 0f 1f 80 00 00 00 00 31 c0 c3 0f 1f 44 00 00 48 89 f8 66 0f 3a 63 00 12 &lt;72&gt; 11 0f 1f 44 00 00 48 83 c0 10 66 0f 3a 63 00 12 73 f4 48 63 c9
RSP: 002b:00007fff5b9bbf68 EFLAGS: 00000ac3
RAX: 000055d91e2fb4c0 RBX: 000055d91e2fb4bf RCX: 0000000000000000
RDX: 0000000000000001 RSI: 000000000000000f RDI: 000055d91e2fb4bf
RBP: 00007fff5b9bbfe0 R08: 000055d91e2fb4b0 R09: 00007fc58cb5dbe0
R10: 0000000000020000 R11: 0000000000000246 R12: 000055d94f7b3391
R13: 000055d91e30395a R14: 000055d94f7b3390 R15: 000055d94f7d5cf0
 </task>

Allocated by task 159:
 kasan_save_stack+0x24/0x50 mm/kasan/common.c:47
 kasan_save_track+0x14/0x30 mm/kasan/common.c:68
 poison_kmalloc_redzone mm/kasan/common.c:377 [inline]
 __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:394
 kasan_kmalloc include/linux/kasan.h:260 [inline]
 __do_kmalloc_node mm/slub.c:4294 [inline]
 __kmalloc_node_track_caller_noprof+0x20b/0x5f0 mm/slub.c:4313
 kmalloc_reserve+0xed/0x2b0 net/core/skbuff.c:537
 __alloc_skb+0x162/0x370 net/core/skbuff.c:606
 alloc_skb include/linux/skbuff.h:1331 [inline]
 nsim_dev_trap_skb_build drivers/net/netdevsim/dev.c:748 [inline]
 nsim_dev_trap_report drivers/net/netdevsim/dev.c:805 [inline]
 nsim_dev_trap_report_work+0x347/0xcf0 drivers/net/netdevsim/dev.c:851
 process_one_work kernel/workqueue.c:3246 [inline]
 process_scheduled_works+0x61a/0x1af0 kernel/workqueue.c:3330
 worker_thread+0x59f/0xcf0 kernel/workqueue.c:3411
 kthread+0x427/0x880 kernel/kthread.c:464
 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:148
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

Freed by task 159:
 kasan_save_stack+0x24/0x50 mm/kasan/common.c:47
 kasan_save_track+0x14/0x30 mm/kasan/common.c:68
 kasan_save_free_info+0x3a/0x60 mm/kasan/generic.c:576
 poison_slab_object mm/kasan/common.c:247 [inline]
 __kasan_slab_free+0x54/0x70 mm/kasan/common.c:264
 kasan_slab_free include/linux/kasan.h:233 [inline]
 slab_free_hook mm/slub.c:2353 [inline]
 slab_free mm/slub.c:4609 [inline]
 kfree+0x14d/0x450 mm/slub.c:4757
 skb_kfree_head net/core/skbuff.c:996 [inline]
 skb_free_head+0xdc/0x190 net/core/skbuff.c:1008
 skb_release_data+0x74a/0x960 net/core/skbuff.c:1035
 skb_release_all+0x4e/0x60 net/core/skbuff.c:1100
 __kfree_skb net/core/skbuff.c:1114 [inline]
 consume_skb net/core/skbuff.c:1346 [inline]
 consume_skb+0xf5/0x2c0 net/core/skbuff.c:1340
 nsim_dev_trap_report drivers/net/netdevsim/dev.c:821 [inline]
 nsim_dev_trap_report_work+0x256/0xcf0 drivers/net/netdevsim/dev.c:851
 process_one_work kernel/workqueue.c:3246 [inline]
 process_scheduled_works+0x61a/0x1af0 kernel/workqueue.c:3330
 worker_thread+0x59f/0xcf0 kernel/workqueue.c:3411
 kthread+0x427/0x880 kernel/kthread.c:464
 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:148
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

The buggy address belongs to the object at ffff8880295c0000
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 0 bytes inside of
 4096-byte region [ffff8880295c0000, ffff8880295c1000)

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x295c0
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 ffff88801b042140 dead000000000122 0000000000000000
raw: 0000000000000000 0000000000040004 00000000f5000000 0000000000000000
head: 00fff00000000040 ffff88801b042140 dead000000000122 0000000000000000
head: 0000000000000000 0000000000040004 00000000f5000000 0000000000000000
head: 00fff00000000003 ffffea0000a57001 ffffffffffffffff 0000000000000000
head: 0000000500000008 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 0xd2820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 159, tgid 159 (kworker/u9:3), ts 519565493420, free_ts 518794223565
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook mm/page_alloc.c:1551 [inline]
 prep_new_page+0x1b0/0x1e0 mm/page_alloc.c:1559
 get_page_from_freelist+0x19a2/0x3250 mm/page_alloc.c:3477
 __alloc_pages_slowpath.constprop.0+0x302/0x2290 mm/page_alloc.c:4288
 __alloc_frozen_pages_noprof+0x5aa/0x6b0 mm/page_alloc.c:4752
 alloc_pages_mpol+0x20a/0x550 mm/mempolicy.c:2270
 alloc_slab_page mm/slub.c:2423 [inline]
 allocate_slab mm/slub.c:2587 [inline]
 new_slab+0x251/0x350 mm/slub.c:2640
 ___slab_alloc+0xe40/0x1740 mm/slub.c:3826
 __slab_alloc.isra.0+0x56/0xb0 mm/slub.c:3916
 __slab_alloc_node mm/slub.c:3991 [inline]
 slab_alloc_node mm/slub.c:4152 [inline]
 __do_kmalloc_node mm/slub.c:4293 [inline]
 __kmalloc_node_track_caller_noprof+0x2cc/0x5f0 mm/slub.c:4313
 kmalloc_reserve+0xed/0x2b0 net/core/skbuff.c:537
 __alloc_skb+0x162/0x370 net/core/skbuff.c:606
 alloc_skb include/linux/skbuff.h:1331 [inline]
 nsim_dev_trap_skb_build drivers/net/netdevsim/dev.c:748 [inline]
 nsim_dev_trap_report drivers/net/netdevsim/dev.c:805 [inline]
 nsim_dev_trap_report_work+0x347/0xcf0 drivers/net/netdevsim/dev.c:851
 process_one_work kernel/workqueue.c:3246 [inline]
 process_scheduled_works+0x61a/0x1af0 kernel/workqueue.c:3330
 worker_thread+0x59f/0xcf0 kernel/workqueue.c:3411
 kthread+0x427/0x880 kernel/kthread.c:464
 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:148
page last free pid 13256 tgid 13255 stack trace:
 reset_page_owner include/linux/page_owner.h:25 [inline]
 free_pages_prepare mm/page_alloc.c:1127 [inline]
 __free_pages_ok+0x691/0x10a0 mm/page_alloc.c:1271
 __folio_put+0x304/0x3d0 mm/swap.c:112
 kfree+0x32f/0x450 mm/slub.c:4751
 kvfree+0x46/0x50 mm/util.c:705
 exfat_free_upcase_table fs/exfat/nls.c:803 [inline]
 exfat_create_upcase_table+0x988/0xcf0 fs/exfat/nls.c:784
 __exfat_fill_super fs/exfat/super.c:628 [inline]
 exfat_fill_super+0x15ef/0x2cc0 fs/exfat/super.c:678
 get_tree_bdev_flags+0x389/0x620 fs/super.c:1636
 vfs_get_tree+0x90/0x340 fs/super.c:1814
 do_new_mount fs/namespace.c:3560 [inline]
 path_mount+0x1290/0x1bc0 fs/namespace.c:3887
 do_mount+0xb4/0x110 fs/namespace.c:3900
 __do_sys_mount fs/namespace.c:4111 [inline]
 __se_sys_mount fs/namespace.c:4088 [inline]
 __x64_sys_mount+0x193/0x230 fs/namespace.c:4088
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcf/0x250 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Memory state around the buggy address:
 ffff8880295bff00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8880295bff80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
&gt;ffff8880295c0000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff8880295c0080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880295c0100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================



I hope it helps.
Best regards
Jianzhou Zhao</strforexctzzchange@xxxxxxxxxxx></xrivendell7@xxxxxxxxx></xnxc22xnxc22@xxxxxx>




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux