================================================================== BUG: KASAN: slab-use-after-free in nr_dec_obs net/netrom/nr_route.c:471 [inline] BUG: KASAN: slab-use-after-free in nr_rt_ioctl+0x24ce/0x29e0 net/netrom/nr_route.c:692 Read of size 4 at addr ffff88803836c230 by task syz.3.1462/9321 CPU: 1 UID: 0 PID: 9321 Comm: syz.3.1462 Not tainted syzkaller #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x156/0x4c9 mm/kasan/report.c:482 kasan_report+0xdf/0x1e0 mm/kasan/report.c:595 nr_dec_obs net/netrom/nr_route.c:471 [inline] nr_rt_ioctl+0x24ce/0x29e0 net/netrom/nr_route.c:692 nr_ioctl+0x16e/0x2d0 net/netrom/af_netrom.c:1254 sock_do_ioctl+0x118/0x280 net/socket.c:1254 sock_ioctl+0x599/0x6b0 net/socket.c:1375 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:597 [inline] __se_sys_ioctl fs/ioctl.c:583 [inline] __x64_sys_ioctl+0x18e/0x210 fs/ioctl.c:583 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x106/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f2942d9a679 Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 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 e8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f2943b66028 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f2943005fa0 RCX: 00007f2942d9a679 RDX: 0000000000000000 RSI: 00000000000089e2 RDI: 0000000000000004 RBP: 00007f2942e2dee0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f2943006038 R14: 00007f2943005fa0 R15: 00007ffc373afae8 Allocated by task 9320: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 poison_kmalloc_redzone mm/kasan/common.c:398 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:415 kmalloc_noprof include/linux/slab.h:950 [inline] nr_add_node+0xe0e/0x2cb0 net/netrom/nr_route.c:146 nr_rt_ioctl+0x16a5/0x29e0 net/netrom/nr_route.c:651 nr_ioctl+0x16e/0x2d0 net/netrom/af_netrom.c:1254 sock_do_ioctl+0x118/0x280 net/socket.c:1254 sock_ioctl+0x599/0x6b0 net/socket.c:1375 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:597 [inline] __se_sys_ioctl fs/ioctl.c:583 [inline] __x64_sys_ioctl+0x18e/0x210 fs/ioctl.c:583 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x106/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 9321: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 kasan_save_free_info+0x3b/0x70 mm/kasan/generic.c:584 poison_slab_object mm/kasan/common.c:253 [inline] __kasan_slab_free+0x5f/0x80 mm/kasan/common.c:285 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:2685 [inline] slab_free mm/slub.c:6165 [inline] kfree+0x1f6/0x6b0 mm/slub.c:6483 nr_neigh_put include/net/netrom.h:143 [inline] nr_neigh_put include/net/netrom.h:137 [inline] nr_dec_obs net/netrom/nr_route.c:469 [inline] nr_rt_ioctl+0x67e/0x29e0 net/netrom/nr_route.c:692 nr_ioctl+0x16e/0x2d0 net/netrom/af_netrom.c:1254 sock_do_ioctl+0x118/0x280 net/socket.c:1254 sock_ioctl+0x599/0x6b0 net/socket.c:1375 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:597 [inline] __se_sys_ioctl fs/ioctl.c:583 [inline] __x64_sys_ioctl+0x18e/0x210 fs/ioctl.c:583 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x106/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff88803836c200 which belongs to the cache kmalloc-64 of size 64 The buggy address is located 48 bytes inside of freed 64-byte region [ffff88803836c200, ffff88803836c240) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x3836c flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000000 ffff88801b8428c0 dead000000000100 dead000000000122 raw: 0000000000000000 0000000800200020 00000000f5000000 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0xd2cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 1, tgid 1 (init), ts 28445381605, free_ts 28038673384 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x153/0x170 mm/page_alloc.c:1889 prep_new_page mm/page_alloc.c:1897 [inline] get_page_from_freelist+0x111d/0x3140 mm/page_alloc.c:3962 __alloc_frozen_pages_noprof+0x27c/0x2ba0 mm/page_alloc.c:5250 alloc_slab_page mm/slub.c:3292 [inline] allocate_slab mm/slub.c:3481 [inline] new_slab+0xa6/0x6b0 mm/slub.c:3539 refill_objects+0x26b/0x400 mm/slub.c:7175 refill_sheaf mm/slub.c:2812 [inline] __pcs_replace_empty_main+0x1ab/0x660 mm/slub.c:4615 alloc_from_pcs mm/slub.c:4717 [inline] slab_alloc_node mm/slub.c:4851 [inline] __do_kmalloc_node mm/slub.c:5259 [inline] __kmalloc_noprof+0x688/0x850 mm/slub.c:5272 kmalloc_noprof include/linux/slab.h:954 [inline] str_read+0x57/0x200 security/selinux/ss/policydb.c:1110 type_read+0x331/0x4d0 security/selinux/ss/policydb.c:1510 policydb_read+0x7af/0x3ab0 security/selinux/ss/policydb.c:2588 security_load_policy+0x15c/0x1080 security/selinux/ss/services.c:2325 sel_write_load+0x2ab/0x560 security/selinux/selinuxfs.c:614 vfs_write+0x2aa/0x1070 fs/read_write.c:686 ksys_write+0x12a/0x250 fs/read_write.c:740 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x106/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f page last free pid 1 tgid 1 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] __free_pages_prepare mm/page_alloc.c:1433 [inline] __free_frozen_pages+0x7e1/0x10d0 mm/page_alloc.c:2978 kasan_depopulate_vmalloc_pte+0x5d/0x80 mm/kasan/shadow.c:484 apply_to_pte_range mm/memory.c:3243 [inline] apply_to_pmd_range mm/memory.c:3287 [inline] apply_to_pud_range mm/memory.c:3323 [inline] apply_to_p4d_range mm/memory.c:3359 [inline] __apply_to_page_range+0xb1d/0x1520 mm/memory.c:3395 __kasan_release_vmalloc+0xd7/0xe0 mm/kasan/shadow.c:602 kasan_release_vmalloc include/linux/kasan.h:593 [inline] kasan_release_vmalloc_node mm/vmalloc.c:2290 [inline] purge_vmap_node+0x210/0xb40 mm/vmalloc.c:2312 __purge_vmap_area_lazy+0x935/0xc20 mm/vmalloc.c:2402 _vm_unmap_aliases+0x40e/0x630 mm/vmalloc.c:2996 change_page_attr_set_clr+0x252/0x4a0 arch/x86/mm/pat/set_memory.c:2082 change_page_attr_set arch/x86/mm/pat/set_memory.c:2123 [inline] set_memory_nx+0xb5/0x110 arch/x86/mm/pat/set_memory.c:2299 free_init_pages+0x79/0xe0 arch/x86/mm/init.c:933 free_kernel_image_pages+0x24/0x50 arch/x86/mm/init.c:952 kernel_init+0x33/0x1e0 init/main.c:1591 ret_from_fork+0x754/0xd80 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Memory state around the buggy address: ffff88803836c100: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff88803836c180: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc >ffff88803836c200: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ^ ffff88803836c280: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc ffff88803836c300: 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc ==================================================================