================================================================== BUG: KASAN: slab-out-of-bounds in idempotent kernel/module/main.c:3078 [inline] BUG: KASAN: slab-out-of-bounds in init_module_from_file+0x62c/0x6a0 kernel/module/main.c:3124 Read of size 8 at addr ffff88807b7656f8 by task syz-executor.2/7999 CPU: 0 PID: 7999 Comm: syz-executor.2 Not tainted 6.4.0-next-20230703-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106 print_address_description.constprop.0+0x2c/0x3c0 mm/kasan/report.c:364 print_report mm/kasan/report.c:475 [inline] kasan_report+0x11d/0x130 mm/kasan/report.c:588 idempotent kernel/module/main.c:3078 [inline] init_module_from_file+0x62c/0x6a0 kernel/module/main.c:3124 __do_sys_finit_module kernel/module/main.c:3171 [inline] __se_sys_finit_module kernel/module/main.c:3154 [inline] __x64_sys_finit_module+0xfd/0x190 kernel/module/main.c:3154 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f9a5128c389 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f9a52014168 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 RAX: ffffffffffffffda RBX: 00007f9a513ac050 RCX: 00007f9a5128c389 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000004 RBP: 00007f9a512d7493 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffe10fc01ff R14: 00007f9a52014300 R15: 0000000000022000 Allocated by task 5053: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 __kasan_slab_alloc+0x7f/0x90 mm/kasan/common.c:328 kasan_slab_alloc include/linux/kasan.h:186 [inline] slab_post_alloc_hook mm/slab.h:750 [inline] slab_alloc_node mm/slub.c:3470 [inline] slab_alloc mm/slub.c:3478 [inline] __kmem_cache_alloc_lru mm/slub.c:3485 [inline] kmem_cache_alloc+0x16c/0x380 mm/slub.c:3494 kmem_cache_zalloc include/linux/slab.h:690 [inline] net_alloc net/core/net_namespace.c:417 [inline] copy_net_ns+0x130/0x6c0 net/core/net_namespace.c:476 create_new_namespaces+0x3f6/0xb20 kernel/nsproxy.c:110 unshare_nsproxy_namespaces+0xc1/0x1f0 kernel/nsproxy.c:228 ksys_unshare+0x449/0x920 kernel/fork.c:3437 __do_sys_unshare kernel/fork.c:3508 [inline] __se_sys_unshare kernel/fork.c:3506 [inline] __x64_sys_unshare+0x31/0x40 kernel/fork.c:3506 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Last potentially related work creation: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 __kasan_record_aux_stack+0xb9/0xd0 mm/kasan/generic.c:491 insert_work+0x48/0x360 kernel/workqueue.c:1553 __queue_work+0x625/0x1120 kernel/workqueue.c:1714 call_timer_fn+0x1a0/0x580 kernel/time/timer.c:1700 expire_timers+0xbc/0x4b0 kernel/time/timer.c:1746 __run_timers kernel/time/timer.c:2022 [inline] __run_timers kernel/time/timer.c:1995 [inline] run_timer_softirq+0x64c/0x910 kernel/time/timer.c:2037 __do_softirq+0x1d4/0x905 kernel/softirq.c:553 The buggy address belongs to the object at ffff88807b763a00 which belongs to the cache net_namespace of size 7168 The buggy address is located 248 bytes to the right of allocated 7168-byte region [ffff88807b763a00, ffff88807b765600) The buggy address belongs to the physical page: page:ffffea0001edd800 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7b760 head:ffffea0001edd800 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000010200 ffff888014675640 dead000000000122 0000000000000000 raw: 0000000000000000 0000000000040004 00000001ffffffff 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 5057, tgid 5057 (syz-executor.3), ts 102869555291, free_ts 102835798793 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2db/0x350 mm/page_alloc.c:1570 prep_new_page mm/page_alloc.c:1577 [inline] get_page_from_freelist+0xfd9/0x2c40 mm/page_alloc.c:3257 __alloc_pages+0x1cb/0x4a0 mm/page_alloc.c:4513 alloc_pages+0x1aa/0x270 mm/mempolicy.c:2279 alloc_slab_page mm/slub.c:1862 [inline] allocate_slab+0x25f/0x390 mm/slub.c:2009 new_slab mm/slub.c:2062 [inline] ___slab_alloc+0xbc3/0x15d0 mm/slub.c:3215 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3314 __slab_alloc_node mm/slub.c:3367 [inline] slab_alloc_node mm/slub.c:3460 [inline] slab_alloc mm/slub.c:3478 [inline] __kmem_cache_alloc_lru mm/slub.c:3485 [inline] kmem_cache_alloc+0x365/0x380 mm/slub.c:3494 kmem_cache_zalloc include/linux/slab.h:690 [inline] net_alloc net/core/net_namespace.c:417 [inline] copy_net_ns+0x130/0x6c0 net/core/net_namespace.c:476 create_new_namespaces+0x3f6/0xb20 kernel/nsproxy.c:110 unshare_nsproxy_namespaces+0xc1/0x1f0 kernel/nsproxy.c:228 ksys_unshare+0x449/0x920 kernel/fork.c:3437 __do_sys_unshare kernel/fork.c:3508 [inline] __se_sys_unshare kernel/fork.c:3506 [inline] __x64_sys_unshare+0x31/0x40 kernel/fork.c:3506 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1161 [inline] free_unref_page_prepare+0x62e/0xcb0 mm/page_alloc.c:2384 free_unref_page+0x33/0x370 mm/page_alloc.c:2479 __unfreeze_partials+0x1fe/0x220 mm/slub.c:2647 qlink_free mm/kasan/quarantine.c:166 [inline] qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:185 kasan_quarantine_reduce+0x195/0x220 mm/kasan/quarantine.c:292 __kasan_slab_alloc+0x63/0x90 mm/kasan/common.c:305 kasan_slab_alloc include/linux/kasan.h:186 [inline] slab_post_alloc_hook mm/slab.h:750 [inline] slab_alloc_node mm/slub.c:3470 [inline] __kmem_cache_alloc_node+0x1ce/0x350 mm/slub.c:3509 __do_kmalloc_node mm/slab_common.c:984 [inline] __kmalloc_node+0x51/0x1a0 mm/slab_common.c:992 kmalloc_node include/linux/slab.h:599 [inline] kvmalloc_node+0xa2/0x1a0 mm/util.c:604 kvmalloc include/linux/slab.h:717 [inline] kvzalloc include/linux/slab.h:725 [inline] proc_sys_call_handler+0x37d/0x6e0 fs/proc/proc_sysctl.c:581 call_write_iter include/linux/fs.h:1871 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x981/0xda0 fs/read_write.c:584 ksys_write+0x122/0x250 fs/read_write.c:637 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Memory state around the buggy address: ffff88807b765580: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88807b765600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88807b765680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ^ ffff88807b765700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88807b765780: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ==================================================================