================================================================== BUG: KASAN: use-after-free in instrument_atomic_read_write include/linux/instrumented.h:101 [inline] BUG: KASAN: use-after-free in atomic_add_negative include/asm-generic/atomic-instrumented.h:556 [inline] BUG: KASAN: use-after-free in get_ucounts+0x28/0x160 kernel/ucount.c:152 Write of size 4 at addr ffff8880159da21c by task syz-executor.2/10827 CPU: 0 PID: 10827 Comm: syz-executor.2 Not tainted 5.14.0-rc1-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1ae/0x29f lib/dump_stack.c:105 print_address_description+0x66/0x3b0 mm/kasan/report.c:233 __kasan_report mm/kasan/report.c:419 [inline] kasan_report+0x163/0x210 mm/kasan/report.c:436 check_region_inline mm/kasan/generic.c:135 [inline] kasan_check_range+0x2b5/0x2f0 mm/kasan/generic.c:189 instrument_atomic_read_write include/linux/instrumented.h:101 [inline] atomic_add_negative include/asm-generic/atomic-instrumented.h:556 [inline] get_ucounts+0x28/0x160 kernel/ucount.c:152 set_cred_ucounts+0x220/0x2d0 kernel/cred.c:684 __sys_setuid+0x34b/0x490 kernel/sys.c:623 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x4665d9 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f2df9cbf188 EFLAGS: 00000246 ORIG_RAX: 0000000000000069 RAX: ffffffffffffffda RBX: 000000000056bf80 RCX: 00000000004665d9 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00000000000000ff RBP: 00000000004bfcb9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000056bf80 R13: 00007ffddd89fcaf R14: 00007f2df9cbf300 R15: 0000000000022000 Allocated by task 10794: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:434 [inline] ____kasan_kmalloc+0xc4/0xf0 mm/kasan/common.c:513 kasan_kmalloc include/linux/kasan.h:264 [inline] kmem_cache_alloc_trace+0x96/0x340 mm/slub.c:2983 kmalloc include/linux/slab.h:591 [inline] kzalloc include/linux/slab.h:721 [inline] alloc_ucounts+0x176/0x420 kernel/ucount.c:169 set_cred_ucounts+0x220/0x2d0 kernel/cred.c:684 __sys_setuid+0x34b/0x490 kernel/sys.c:623 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Freed by task 10828: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x3d/0x70 mm/kasan/common.c:46 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360 ____kasan_slab_free+0x109/0x150 mm/kasan/common.c:366 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:1625 [inline] slab_free_freelist_hook+0x1d8/0x290 mm/slub.c:1650 slab_free mm/slub.c:3210 [inline] kfree+0xcf/0x2d0 mm/slub.c:4262 put_cred_rcu+0x221/0x400 kernel/cred.c:124 rcu_do_batch kernel/rcu/tree.c:2550 [inline] rcu_core+0x906/0x14b0 kernel/rcu/tree.c:2785 __do_softirq+0x372/0x783 kernel/softirq.c:558 Last potentially related work creation: kasan_save_stack+0x27/0x50 mm/kasan/common.c:38 kasan_record_aux_stack+0xee/0x120 mm/kasan/generic.c:348 insert_work+0x54/0x400 kernel/workqueue.c:1332 __queue_work+0x928/0xc60 kernel/workqueue.c:1498 queue_work_on+0x111/0x200 kernel/workqueue.c:1525 queue_work include/linux/workqueue.h:507 [inline] call_usermodehelper_exec+0x283/0x470 kernel/umh.c:435 kobject_uevent_env+0x1337/0x1700 lib/kobject_uevent.c:618 __kobject_del+0x286/0x310 lib/kobject.c:617 kobject_cleanup+0x174/0x280 lib/kobject.c:696 netdev_queue_update_kobjects+0x38d/0x400 net/core/net-sysfs.c:1670 remove_queue_kobjects net/core/net-sysfs.c:1767 [inline] netdev_unregister_kobject+0x100/0x1b0 net/core/net-sysfs.c:1917 unregister_netdevice_many+0x145b/0x1980 net/core/dev.c:11102 unregister_netdevice_queue+0x2e6/0x350 net/core/dev.c:11009 unregister_netdevice include/linux/netdevice.h:2969 [inline] hsr_dev_finalize+0x5cf/0x760 net/hsr/hsr_device.c:560 hsr_newlink+0x675/0x730 net/hsr/hsr_netlink.c:102 __rtnl_newlink net/core/rtnetlink.c:3460 [inline] rtnl_newlink+0x13f6/0x1cd0 net/core/rtnetlink.c:3508 rtnetlink_rcv_msg+0x91c/0xe50 net/core/rtnetlink.c:5574 netlink_rcv_skb+0x1f0/0x460 net/netlink/af_netlink.c:2504 netlink_unicast_kernel net/netlink/af_netlink.c:1314 [inline] netlink_unicast+0x7de/0x9b0 net/netlink/af_netlink.c:1340 netlink_sendmsg+0x9e7/0xe00 net/netlink/af_netlink.c:1929 sock_sendmsg_nosec net/socket.c:703 [inline] sock_sendmsg net/socket.c:723 [inline] ____sys_sendmsg+0x5a2/0x900 net/socket.c:2392 ___sys_sendmsg net/socket.c:2446 [inline] __sys_sendmsg+0x319/0x400 net/socket.c:2475 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Second to last potentially related work creation: kasan_save_stack+0x27/0x50 mm/kasan/common.c:38 kasan_record_aux_stack+0xee/0x120 mm/kasan/generic.c:348 insert_work+0x54/0x400 kernel/workqueue.c:1332 __queue_work+0x928/0xc60 kernel/workqueue.c:1498 queue_work_on+0x111/0x200 kernel/workqueue.c:1525 queue_work include/linux/workqueue.h:507 [inline] call_usermodehelper_exec+0x283/0x470 kernel/umh.c:435 kobject_uevent_env+0x1337/0x1700 lib/kobject_uevent.c:618 netdev_queue_add_kobject net/core/net-sysfs.c:1621 [inline] netdev_queue_update_kobjects+0x1c6/0x400 net/core/net-sysfs.c:1655 register_queue_kobjects net/core/net-sysfs.c:1716 [inline] netdev_register_kobject+0x263/0x310 net/core/net-sysfs.c:1959 register_netdevice+0x12a1/0x1c20 net/core/dev.c:10331 __ip_tunnel_create+0x2a0/0x360 net/ipv4/ip_tunnel.c:267 ip_tunnel_init_net+0x217/0x6f0 net/ipv4/ip_tunnel.c:1069 ops_init+0x313/0x430 net/core/net_namespace.c:140 setup_net+0x35b/0x9d0 net/core/net_namespace.c:333 copy_net_ns+0x359/0x5c0 net/core/net_namespace.c:474 create_new_namespaces+0x4ce/0xa00 kernel/nsproxy.c:110 unshare_nsproxy_namespaces+0x11e/0x180 kernel/nsproxy.c:226 ksys_unshare+0x57d/0xb50 kernel/fork.c:3002 __do_sys_unshare kernel/fork.c:3076 [inline] __se_sys_unshare kernel/fork.c:3074 [inline] __x64_sys_unshare+0x34/0x40 kernel/fork.c:3074 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff8880159da200 which belongs to the cache kmalloc-192 of size 192 The buggy address is located 28 bytes inside of 192-byte region [ffff8880159da200, ffff8880159da2c0) The buggy address belongs to the page: page:ffffea0000567680 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x159da flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea0000a04e00 0000000900000009 ffff888011041a00 raw: 0000000000000000 0000000000100010 00000001ffffffff 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 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 1, ts 2252157053, free_ts 0 prep_new_page mm/page_alloc.c:2433 [inline] get_page_from_freelist+0x779/0xa30 mm/page_alloc.c:4166 __alloc_pages+0x26c/0x5f0 mm/page_alloc.c:5388 alloc_page_interleave+0x22/0x1c0 mm/mempolicy.c:2119 alloc_slab_page mm/slub.c:1688 [inline] allocate_slab+0xf1/0x540 mm/slub.c:1828 new_slab mm/slub.c:1891 [inline] new_slab_objects mm/slub.c:2637 [inline] ___slab_alloc+0x1cf/0x350 mm/slub.c:2800 __slab_alloc mm/slub.c:2840 [inline] slab_alloc_node mm/slub.c:2922 [inline] slab_alloc mm/slub.c:2964 [inline] kmem_cache_alloc_trace+0x29d/0x340 mm/slub.c:2981 kmalloc include/linux/slab.h:591 [inline] kzalloc include/linux/slab.h:721 [inline] kset_create lib/kobject.c:969 [inline] kset_create_and_add+0x55/0x280 lib/kobject.c:1012 bus_register+0x329/0x870 drivers/base/bus.c:812 spi_init+0x5c/0xfa drivers/spi/spi.c:4281 do_one_initcall+0x197/0x3f0 init/main.c:1282 do_initcall_level+0x14a/0x1f5 init/main.c:1355 do_initcalls+0x4b/0x8c init/main.c:1371 kernel_init_freeable+0x3f1/0x57e init/main.c:1593 kernel_init+0x19/0x2a0 init/main.c:1485 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 page_owner free stack trace missing Memory state around the buggy address: ffff8880159da100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff8880159da180: 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8880159da200: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880159da280: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff8880159da300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ==================================================================