================================================================== BUG: KASAN: use-after-free in cipso_v4_genopt+0x1078/0x1700 net/ipv4/cipso_ipv4.c:1784 Read of size 1 at addr ffff88801817ca90 by task kworker/u5:2/8369 CPU: 1 PID: 8369 Comm: kworker/u5:2 Not tainted 5.11.0-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: xprtiod xs_udp_setup_socket Call Trace: __dump_stack lib/dump_stack.c:79 [inline] dump_stack+0x125/0x19e lib/dump_stack.c:120 print_address_description+0x5f/0x3a0 mm/kasan/report.c:230 __kasan_report mm/kasan/report.c:397 [inline] kasan_report+0x15e/0x200 mm/kasan/report.c:414 cipso_v4_genopt+0x1078/0x1700 net/ipv4/cipso_ipv4.c:1784 cipso_v4_sock_setattr+0x7c/0x460 net/ipv4/cipso_ipv4.c:1866 netlbl_sock_setattr+0x28e/0x2f0 net/netlabel/netlabel_kapi.c:995 smack_netlbl_add security/smack/smack_lsm.c:2404 [inline] smack_socket_post_create+0x13b/0x280 security/smack/smack_lsm.c:2774 security_socket_post_create+0x6f/0xd0 security/security.c:2122 __sock_create+0x62f/0x8c0 net/socket.c:1424 xs_create_sock+0x80/0x6c0 net/sunrpc/xprtsock.c:1778 xs_udp_setup_socket+0x5e/0x600 net/sunrpc/xprtsock.c:2043 process_one_work+0x789/0xfd0 kernel/workqueue.c:2275 worker_thread+0xac1/0x1300 kernel/workqueue.c:2421 kthread+0x39a/0x3c0 kernel/kthread.c:292 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294 Allocated by task 4805: 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:400 [inline] ____kasan_kmalloc+0xbd/0xf0 mm/kasan/common.c:428 kasan_kmalloc include/linux/kasan.h:218 [inline] __kmalloc+0xb4/0x330 mm/slub.c:4028 kmalloc include/linux/slab.h:559 [inline] kzalloc include/linux/slab.h:684 [inline] tomoyo_encode2+0x25a/0x560 security/tomoyo/realpath.c:45 tomoyo_encode security/tomoyo/realpath.c:80 [inline] tomoyo_realpath_from_path+0x5c3/0x610 security/tomoyo/realpath.c:288 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_check_open_permission+0x198/0x3c0 security/tomoyo/file.c:771 security_file_open+0x50/0xc0 security/security.c:1589 do_dentry_open+0x36b/0x1010 fs/open.c:813 do_open fs/namei.c:3365 [inline] path_openat+0x27c9/0x3860 fs/namei.c:3498 do_filp_open+0x191/0x3a0 fs/namei.c:3525 do_sys_openat2+0xba/0x380 fs/open.c:1187 do_sys_open fs/open.c:1203 [inline] __do_sys_open fs/open.c:1211 [inline] __se_sys_open fs/open.c:1207 [inline] __x64_sys_open+0x1af/0x1e0 fs/open.c:1207 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xae Freed by task 4805: 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:356 ____kasan_slab_free+0xd3/0x110 mm/kasan/common.c:361 kasan_slab_free include/linux/kasan.h:191 [inline] slab_free_hook mm/slub.c:1561 [inline] slab_free_freelist_hook+0xdd/0x1b0 mm/slub.c:1594 slab_free mm/slub.c:3146 [inline] kfree+0xcf/0x2b0 mm/slub.c:4182 tomoyo_check_open_permission+0x2cf/0x3c0 security/tomoyo/file.c:786 security_file_open+0x50/0xc0 security/security.c:1589 do_dentry_open+0x36b/0x1010 fs/open.c:813 do_open fs/namei.c:3365 [inline] path_openat+0x27c9/0x3860 fs/namei.c:3498 do_filp_open+0x191/0x3a0 fs/namei.c:3525 do_sys_openat2+0xba/0x380 fs/open.c:1187 do_sys_open fs/open.c:1203 [inline] __do_sys_open fs/open.c:1211 [inline] __se_sys_open fs/open.c:1207 [inline] __x64_sys_open+0x1af/0x1e0 fs/open.c:1207 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xae Last potentially related work creation: kasan_save_stack+0x27/0x50 mm/kasan/common.c:38 kasan_record_aux_stack+0xcc/0x100 mm/kasan/generic.c:344 __call_rcu kernel/rcu/tree.c:3039 [inline] call_rcu+0x12f/0x8a0 kernel/rcu/tree.c:3114 cipso_v4_doi_remove+0x2e2/0x310 net/ipv4/cipso_ipv4.c:531 netlbl_cipsov4_remove+0x219/0x390 net/netlabel/netlabel_cipso_v4.c:715 genl_family_rcv_msg_doit net/netlink/genetlink.c:739 [inline] genl_family_rcv_msg net/netlink/genetlink.c:783 [inline] genl_rcv_msg+0xe4e/0x1280 net/netlink/genetlink.c:800 netlink_rcv_skb+0x190/0x3a0 net/netlink/af_netlink.c:2502 genl_rcv+0x24/0x40 net/netlink/genetlink.c:811 netlink_unicast_kernel net/netlink/af_netlink.c:1312 [inline] netlink_unicast+0x786/0x940 net/netlink/af_netlink.c:1338 netlink_sendmsg+0x9ae/0xd50 net/netlink/af_netlink.c:1927 sock_sendmsg_nosec net/socket.c:654 [inline] sock_sendmsg net/socket.c:674 [inline] ____sys_sendmsg+0x519/0x800 net/socket.c:2350 ___sys_sendmsg net/socket.c:2404 [inline] __sys_sendmsg+0x2bf/0x370 net/socket.c:2437 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff88801817ca80 which belongs to the cache kmalloc-64 of size 64 The buggy address is located 16 bytes inside of 64-byte region [ffff88801817ca80, ffff88801817cac0) The buggy address belongs to the page: page:0000000014ac4c33 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1817c flags: 0xfff00000000200(slab) raw: 00fff00000000200 dead000000000100 dead000000000122 ffff888011041640 raw: 0000000000000000 0000000000200020 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88801817c980: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc ffff88801817ca00: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc >ffff88801817ca80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ^ ffff88801817cb00: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc ffff88801817cb80: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc ==================================================================