==================================================================
BUG: KASAN: slab-use-after-free in __lock_acquire+0x2d85/0x3b20 kernel/locking/lockdep.c:5005
Read of size 8 at addr ffff8880725fd818 by task udevd/4680
CPU: 0 PID: 4680 Comm: udevd Not tainted 6.7.0-rc8-syzkaller #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
Call Trace:
__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
__lock_acquire+0x2d85/0x3b20 kernel/locking/lockdep.c:5005
lock_acquire kernel/locking/lockdep.c:5754 [inline]
lock_acquire+0x1ae/0x520 kernel/locking/lockdep.c:5719
__raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
_raw_spin_lock_irqsave+0x3a/0x50 kernel/locking/spinlock.c:162
p9_tag_remove net/9p/client.c:394 [inline]
p9_req_put net/9p/client.c:402 [inline]
p9_req_put+0xc6/0x250 net/9p/client.c:399
req_done+0x1e7/0x2e0 net/9p/trans_virtio.c:147
vring_interrupt drivers/virtio/virtio_ring.c:2595 [inline]
vring_interrupt+0x317/0x3f0 drivers/virtio/virtio_ring.c:2570
__handle_irq_event_percpu+0x22a/0x750 kernel/irq/handle.c:158
handle_irq_event_percpu kernel/irq/handle.c:193 [inline]
handle_irq_event+0xab/0x1e0 kernel/irq/handle.c:210
handle_edge_irq+0x261/0xcf0 kernel/irq/chip.c:831
generic_handle_irq_desc include/linux/irqdesc.h:161 [inline]
handle_irq arch/x86/kernel/irq.c:238 [inline]
__common_interrupt+0xdb/0x240 arch/x86/kernel/irq.c:257
common_interrupt+0xab/0xd0 arch/x86/kernel/irq.c:247
asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:640
RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:152 [inline]
RIP: 0010:_raw_spin_unlock_irqrestore+0x31/0x70 kernel/locking/spinlock.c:194
Code: f5 53 48 8b 74 24 10 48 89 fb 48 83 c7 18 e8 f6 7a e4 f6 48 89 df e8 de f2 e4 f6 f7 c5 00 02 00 00 75 1f 9c 58 f6 c4 02 75 2f 01 00 00 00 e8 95 ab d6 f6 65 8b 05 c6 42 80 75 85 c0 74 12 5b
RSP: 0018:ffffc90002f77508 EFLAGS: 00000246
RAX: 0000000000000002 RBX: ffff8880130409c0 RCX: 1ffffffff23e6c94
RDX: 0000000000000000 RSI: ffffffff8accaea0 RDI: ffffffff8b2efce0
RBP: 0000000000000283 R08: 0000000000000001 R09: fffffbfff23e37d8
R10: ffffffff91f1bec7 R11: 0000000000000002 R12: ffffea00005a9c10
R13: ffffea00005a5800 R14: ffff8880130409c0 R15: ffff888000220000
spin_unlock_irqrestore include/linux/spinlock.h:406 [inline]
get_partial_node.part.0+0x26d/0x480 mm/slub.c:2326
get_partial_node mm/slub.c:2286 [inline]
get_partial mm/slub.c:2404 [inline]
___slab_alloc+0xd25/0x1500 mm/slub.c:3218
__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/0x310 mm/slub.c:3517
__do_kmalloc_node mm/slab_common.c:1006 [inline]
__kmalloc+0x49/0x90 mm/slab_common.c:1020
kmalloc include/linux/slab.h:604 [inline]
tomoyo_realpath_from_path+0xb9/0x710 security/tomoyo/realpath.c:251
tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
tomoyo_check_open_permission+0x2a3/0x3b0 security/tomoyo/file.c:771
tomoyo_file_open security/tomoyo/tomoyo.c:332 [inline]
tomoyo_file_open+0xa8/0xd0 security/tomoyo/tomoyo.c:327
security_file_open+0x6a/0xe0 security/security.c:2836
do_dentry_open+0x583/0x18c0 fs/open.c:935
do_open fs/namei.c:3622 [inline]
path_openat+0x1e5a/0x2c50 fs/namei.c:3779
do_filp_open+0x1de/0x430 fs/namei.c:3809
do_sys_openat2+0x176/0x1e0 fs/open.c:1437
do_sys_open fs/open.c:1452 [inline]
__do_sys_openat fs/open.c:1468 [inline]
__se_sys_openat fs/open.c:1463 [inline]
__x64_sys_openat+0x175/0x210 fs/open.c:1463
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0x40/0x110 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x63/0x6b
RIP: 0033:0x7f26ab51a477
Code: 10 00 00 00 44 8b 54 24 e0 48 89 44 24 c0 48 8d 44 24 d0 48 89 44 24 c8 44 89 c2 4c 89 ce bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 76 10 48 8b 15 82 69 0d 00 f7 d8 64 89 02 48 83
RSP: 002b:00007ffda15e7ff8 EFLAGS: 00000287 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 0000565037931cf0 RCX: 00007f26ab51a477
RDX: 0000000000090800 RSI: 000056503792a510 RDI: 00000000ffffff9c
RBP: 000056503796e1b0 R08: 0000000000090800 R09: 000056503792a510
R10: 0000000000000000 R11: 0000000000000287 R12: 000056503792a510
R13: 00000000000000fd R14: 00005650362991c4 R15: 0000000000000000
Allocated by task 8754:
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
kmalloc include/linux/slab.h:600 [inline]
p9_client_create+0xcf/0x1210 net/9p/client.c:980
v9fs_session_init+0x1f8/0x1a80 fs/9p/v9fs.c:410
v9fs_mount+0xc6/0xcd0 fs/9p/vfs_super.c:123
legacy_get_tree+0x109/0x220 fs/fs_context.c:662
vfs_get_tree+0x8c/0x370 fs/super.c:1771
do_new_mount fs/namespace.c:3337 [inline]
path_mount+0x1492/0x1ed0 fs/namespace.c:3664
do_mount fs/namespace.c:3677 [inline]
__do_sys_mount fs/namespace.c:3886 [inline]
__se_sys_mount fs/namespace.c:3863 [inline]
__ia32_sys_mount+0x291/0x310 fs/namespace.c:3863
do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline]
__do_fast_syscall_32+0x62/0xe0 arch/x86/entry/common.c:321
do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:346
entry_SYSENTER_compat_after_hwframe+0x70/0x7a
Freed by task 8754:
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+0xc0/0x180 mm/slub.c:3822
p9_client_create+0xa14/0x1210 net/9p/client.c:1051
v9fs_session_init+0x1f8/0x1a80 fs/9p/v9fs.c:410
v9fs_mount+0xc6/0xcd0 fs/9p/vfs_super.c:123
legacy_get_tree+0x109/0x220 fs/fs_context.c:662
vfs_get_tree+0x8c/0x370 fs/super.c:1771
do_new_mount fs/namespace.c:3337 [inline]
path_mount+0x1492/0x1ed0 fs/namespace.c:3664
do_mount fs/namespace.c:3677 [inline]
__do_sys_mount fs/namespace.c:3886 [inline]
__se_sys_mount fs/namespace.c:3863 [inline]
__ia32_sys_mount+0x291/0x310 fs/namespace.c:3863
do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline]
__do_fast_syscall_32+0x62/0xe0 arch/x86/entry/common.c:321
do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:346
entry_SYSENTER_compat_after_hwframe+0x70/0x7a
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+0xdf5/0x11d0 kernel/workqueue.c:1800
call_timer_fn+0x193/0x590 kernel/time/timer.c:1700
expire_timers kernel/time/timer.c:1746 [inline]
__run_timers+0x585/0xb20 kernel/time/timer.c:2022
run_timer_softirq+0x58/0xd0 kernel/time/timer.c:2035
__do_softirq+0x21a/0x8de kernel/softirq.c:553
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
__call_rcu_common.constprop.0+0x9a/0x7a0 kernel/rcu/tree.c:2681
in_dev_finish_destroy+0x15c/0x1d0 net/ipv4/devinet.c:258
in_dev_put include/linux/inetdevice.h:279 [inline]
inetdev_destroy net/ipv4/devinet.c:332 [inline]
inetdev_event+0x1664/0x1980 net/ipv4/devinet.c:1623
notifier_call_chain+0xb6/0x3b0 kernel/notifier.c:93
call_netdevice_notifiers_info+0xbe/0x130 net/core/dev.c:1967
call_netdevice_notifiers_extack net/core/dev.c:2005 [inline]
call_netdevice_notifiers net/core/dev.c:2019 [inline]
unregister_netdevice_many_notify+0x85b/0x19a0 net/core/dev.c:11043
unregister_netdevice_many net/core/dev.c:11099 [inline]
unregister_netdevice_queue+0x2e5/0x3d0 net/core/dev.c:10979
unregister_netdevice include/linux/netdevice.h:3158 [inline]
nsim_destroy+0x43/0x190 drivers/net/netdevsim/netdev.c:412
__nsim_dev_port_del+0x189/0x240 drivers/net/netdevsim/dev.c:1425
nsim_dev_port_del_all drivers/net/netdevsim/dev.c:1437 [inline]
nsim_dev_reload_destroy+0x108/0x4d0 drivers/net/netdevsim/dev.c:1658
nsim_drv_remove+0x52/0x1d0 drivers/net/netdevsim/dev.c:1673
device_remove+0xc8/0x170 drivers/base/dd.c:567
__device_release_driver drivers/base/dd.c:1272 [inline]
device_release_driver_internal+0x44a/0x610 drivers/base/dd.c:1295
bus_remove_device+0x22c/0x420 drivers/base/bus.c:574
device_del+0x39a/0xa50 drivers/base/core.c:3814
device_unregister+0x1d/0xc0 drivers/base/core.c:3855
nsim_bus_dev_del drivers/net/netdevsim/bus.c:317 [inline]
del_device_store+0x346/0x4b0 drivers/net/netdevsim/bus.c:226
bus_attr_store+0x76/0xa0 drivers/base/bus.c:170
sysfs_kf_write+0x117/0x170 fs/sysfs/file.c:136
kernfs_fop_write_iter+0x33f/0x500 fs/kernfs/file.c:334
call_write_iter include/linux/fs.h:2020 [inline]
new_sync_write fs/read_write.c:491 [inline]
vfs_write+0x64f/0xdf0 fs/read_write.c:584
ksys_write+0x12f/0x250 fs/read_write.c:637
do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline]
__do_fast_syscall_32+0x62/0xe0 arch/x86/entry/common.c:321
do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:346
entry_SYSENTER_compat_after_hwframe+0x70/0x7a
The buggy address belongs to the object at ffff8880725fd800
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 24 bytes inside of
freed 512-byte region [ffff8880725fd800, ffff8880725fda00)
The buggy address belongs to the physical page:
page:ffffea0001c97f00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x725fc
head:ffffea0001c97f00 order:2 entire_mapcount:0 nr_pages_mapped:0 pincount:0
ksm flags: 0x4fff00000000840(slab|head|node=1|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 04fff00000000840 ffff888013042c80 ffffea0000911100 dead000000000003
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 2, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 1378, tgid 1378 (kworker/3:2), ts 140855736820, free_ts 140499934048
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x2d0/0x350 mm/page_alloc.c:1537
prep_new_page mm/page_alloc.c:1544 [inline]
get_page_from_freelist+0xa25/0x36d0 mm/page_alloc.c:3312
__alloc_pages+0x22e/0x2420 mm/page_alloc.c:4568
alloc_pages_mpol+0x258/0x5f0 mm/mempolicy.c:2133
alloc_slab_page mm/slub.c:1870 [inline]
allocate_slab mm/slub.c:2017 [inline]
new_slab+0x283/0x3c0 mm/slub.c:2070
___slab_alloc+0x979/0x1500 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/0x310 mm/slub.c:3517
kmalloc_trace+0x25/0x60 mm/slab_common.c:1098
kmalloc include/linux/slab.h:600 [inline]
kzalloc include/linux/slab.h:721 [inline]
mca_alloc net/ipv6/mcast.c:880 [inline]
__ipv6_dev_mc_inc+0x2b7/0xc50 net/ipv6/mcast.c:936
addrconf_join_solict net/ipv6/addrconf.c:2200 [inline]
addrconf_dad_begin net/ipv6/addrconf.c:4045 [inline]
addrconf_dad_work+0x232/0x14b0 net/ipv6/addrconf.c:4170
process_one_work+0x886/0x15d0 kernel/workqueue.c:2627
process_scheduled_works kernel/workqueue.c:2700 [inline]
worker_thread+0x8b9/0x1290 kernel/workqueue.c:2781
kthread+0x2c6/0x3a0 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:242
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1137 [inline]
free_unref_page_prepare+0x4fa/0xaa0 mm/page_alloc.c:2347
free_unref_page+0x33/0x3b0 mm/page_alloc.c:2487
__unfreeze_partials+0x226/0x240 mm/slub.c:2655
qlink_free mm/kasan/quarantine.c:168 [inline]
qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:187
kasan_quarantine_reduce+0x18e/0x1d0 mm/kasan/quarantine.c:294
__kasan_slab_alloc+0x65/0x90 mm/kasan/common.c:305
kasan_slab_alloc include/linux/kasan.h:188 [inline]
slab_post_alloc_hook mm/slab.h:763 [inline]
slab_alloc_node mm/slub.c:3478 [inline]
__kmem_cache_alloc_node+0x195/0x310 mm/slub.c:3517
__do_kmalloc_node mm/slab_common.c:1006 [inline]
__kmalloc+0x49/0x90 mm/slab_common.c:1020
kmalloc include/linux/slab.h:604 [inline]
kzalloc include/linux/slab.h:721 [inline]
fib6_info_alloc+0x40/0x100 net/ipv6/ip6_fib.c:155
ip6_route_info_create+0x337/0x1b70 net/ipv6/route.c:3749
ip6_route_add+0x26/0x150 net/ipv6/route.c:3843
addrconf_add_mroute+0x1de/0x350 net/ipv6/addrconf.c:2509
addrconf_add_dev+0x150/0x1c0 net/ipv6/addrconf.c:2527
addrconf_dev_config net/ipv6/addrconf.c:3431 [inline]
addrconf_init_auto_addrs+0x380/0x820 net/ipv6/addrconf.c:3518
addrconf_notify+0x714/0x1920 net/ipv6/addrconf.c:3691
notifier_call_chain+0xb6/0x3b0 kernel/notifier.c:93
Memory state around the buggy address:
ffff8880725fd700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8880725fd780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8880725fd800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880725fd880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880725fd900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess):
0: f5 cmc
1: 53 push %rbx
2: 48 8b 74 24 10 mov 0x10(%rsp),%rsi
7: 48 89 fb mov %rdi,%rbx
a: 48 83 c7 18 add $0x18,%rdi
e: e8 f6 7a e4 f6 call 0xf6e47b09
13: 48 89 df mov %rbx,%rdi
16: e8 de f2 e4 f6 call 0xf6e4f2f9
1b: f7 c5 00 02 00 00 test $0x200,%ebp
21: 75 1f jne 0x42
23: 9c pushf
24: 58 pop %rax
25: f6 c4 02 test $0x2,%ah
28: 75 2f jne 0x59
* 2a: bf 01 00 00 00 mov $0x1,%edi <-- trapping instruction
2f: e8 95 ab d6 f6 call 0xf6d6abc9
34: 65 8b 05 c6 42 80 75 mov %gs:0x758042c6(%rip),%eax # 0x75804301
3b: 85 c0 test %eax,%eax
3d: 74 12 je 0x51
3f: 5b pop %rbx