================================================================== BUG: KASAN: slab-out-of-bounds in memcpy include/linux/string.h:347 [inline] BUG: KASAN: slab-out-of-bounds in __nla_put_nohdr+0x46/0x50 lib/nlattr.c:585 Read of size 8 at addr ffff88809198f880 by task syz-executor.4/7601 CPU: 1 PID: 7601 Comm: syz-executor.4 Not tainted 4.14.168-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x142/0x197 lib/dump_stack.c:58 print_address_description.cold+0x7c/0x1dc mm/kasan/report.c:252 kasan_report_error mm/kasan/report.c:351 [inline] kasan_report mm/kasan/report.c:409 [inline] kasan_report.cold+0xa9/0x2af mm/kasan/report.c:393 check_memory_region_inline mm/kasan/kasan.c:260 [inline] check_memory_region+0x123/0x190 mm/kasan/kasan.c:267 memcpy+0x24/0x50 mm/kasan/kasan.c:302 memcpy include/linux/string.h:347 [inline] __nla_put_nohdr+0x46/0x50 lib/nlattr.c:585 nla_put_nohdr+0xe8/0x120 lib/nlattr.c:651 tcf_em_tree_dump+0x5d1/0x890 net/sched/ematch.c:474 basic_dump net/sched/cls_basic.c:290 [inline] basic_dump+0x1bd/0x410 net/sched/cls_basic.c:270 tcf_fill_node+0x536/0x860 net/sched/cls_api.c:453 tfilter_notify+0x11d/0x240 net/sched/cls_api.c:476 tc_ctl_tfilter+0x1048/0x1aba net/sched/cls_api.c:743 rtnetlink_rcv_msg+0x3da/0xb70 net/core/rtnetlink.c:4306 netlink_rcv_skb+0x14f/0x3c0 net/netlink/af_netlink.c:2432 rtnetlink_rcv+0x1d/0x30 net/core/rtnetlink.c:4318 netlink_unicast_kernel net/netlink/af_netlink.c:1286 [inline] netlink_unicast+0x44d/0x650 net/netlink/af_netlink.c:1312 netlink_sendmsg+0x7c4/0xc60 net/netlink/af_netlink.c:1877 sock_sendmsg_nosec net/socket.c:646 [inline] sock_sendmsg+0xce/0x110 net/socket.c:656 ___sys_sendmsg+0x70a/0x840 net/socket.c:2062 __sys_sendmsg+0xb9/0x140 net/socket.c:2096 SYSC_sendmsg net/socket.c:2107 [inline] SyS_sendmsg+0x2d/0x50 net/socket.c:2103 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 RIP: 0033:0x45b349 RSP: 002b:00007f2734ee5c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007f2734ee66d4 RCX: 000000000045b349 RDX: 0000000000000000 RSI: 00000000200001c0 RDI: 0000000000000003 RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff R13: 00000000000009c2 R14: 00000000004cb338 R15: 000000000075bf2c Allocated by task 7601: save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59 save_stack+0x45/0xd0 mm/kasan/kasan.c:447 set_track mm/kasan/kasan.c:459 [inline] kasan_kmalloc mm/kasan/kasan.c:551 [inline] kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:529 __do_kmalloc mm/slab.c:3720 [inline] __kmalloc_track_caller+0x159/0x790 mm/slab.c:3735 kmemdup+0x27/0x60 mm/util.c:118 kmemdup include/linux/string.h:420 [inline] em_nbyte_change+0xb9/0x130 net/sched/em_nbyte.c:36 tcf_em_validate net/sched/ematch.c:245 [inline] tcf_em_tree_validate net/sched/ematch.c:362 [inline] tcf_em_tree_validate+0x922/0xe7e net/sched/ematch.c:304 basic_set_parms net/sched/cls_basic.c:158 [inline] basic_change+0x451/0xfb0 net/sched/cls_basic.c:222 tc_ctl_tfilter+0xff1/0x1aba net/sched/cls_api.c:738 rtnetlink_rcv_msg+0x3da/0xb70 net/core/rtnetlink.c:4306 netlink_rcv_skb+0x14f/0x3c0 net/netlink/af_netlink.c:2432 rtnetlink_rcv+0x1d/0x30 net/core/rtnetlink.c:4318 netlink_unicast_kernel net/netlink/af_netlink.c:1286 [inline] netlink_unicast+0x44d/0x650 net/netlink/af_netlink.c:1312 netlink_sendmsg+0x7c4/0xc60 net/netlink/af_netlink.c:1877 sock_sendmsg_nosec net/socket.c:646 [inline] sock_sendmsg+0xce/0x110 net/socket.c:656 ___sys_sendmsg+0x70a/0x840 net/socket.c:2062 __sys_sendmsg+0xb9/0x140 net/socket.c:2096 SYSC_sendmsg net/socket.c:2107 [inline] SyS_sendmsg+0x2d/0x50 net/socket.c:2103 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 Freed by task 7434: save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59 save_stack+0x45/0xd0 mm/kasan/kasan.c:447 set_track mm/kasan/kasan.c:459 [inline] kasan_slab_free+0x75/0xc0 mm/kasan/kasan.c:524 __cache_free mm/slab.c:3496 [inline] kfree+0xcc/0x270 mm/slab.c:3815 kvfree+0x4d/0x60 mm/util.c:416 __vunmap+0x24e/0x320 mm/vmalloc.c:1547 vfree+0x50/0xe0 mm/vmalloc.c:1611 copy_entries_to_user net/ipv6/netfilter/ip6_tables.c:885 [inline] get_entries net/ipv6/netfilter/ip6_tables.c:1044 [inline] do_ip6t_get_ctl+0x61d/0x820 net/ipv6/netfilter/ip6_tables.c:1713 nf_sockopt net/netfilter/nf_sockopt.c:104 [inline] nf_getsockopt+0x6a/0xc0 net/netfilter/nf_sockopt.c:122 ipv6_getsockopt net/ipv6/ipv6_sockglue.c:1369 [inline] ipv6_getsockopt+0x182/0x1f0 net/ipv6/ipv6_sockglue.c:1349 tcp_getsockopt net/ipv4/tcp.c:3249 [inline] tcp_getsockopt+0x84/0xd0 net/ipv4/tcp.c:3243 sock_common_getsockopt+0x94/0xd0 net/core/sock.c:2927 SYSC_getsockopt net/socket.c:1896 [inline] SyS_getsockopt+0x126/0x1e0 net/socket.c:1878 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 The buggy address belongs to the object at ffff88809198f880 which belongs to the cache kmalloc-32 of size 32 The buggy address is located 0 bytes inside of 32-byte region [ffff88809198f880, ffff88809198f8a0) The buggy address belongs to the page: page:ffffea00024663c0 count:1 mapcount:0 mapping:ffff88809198f000 index:0xffff88809198ffc1 flags: 0xfffe0000000100(slab) raw: 00fffe0000000100 ffff88809198f000 ffff88809198ffc1 000000010000003f raw: ffffea00027f53a0 ffffea00027ffde0 ffff8880aa8001c0 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88809198f780: fb fb fb fb fc fc fc fc 05 fc fc fc fc fc fc fc ffff88809198f800: 05 fc fc fc fc fc fc fc 05 fc fc fc fc fc fc fc >ffff88809198f880: 04 fc fc fc fc fc fc fc 07 fc fc fc fc fc fc fc ^ ffff88809198f900: 00 00 01 fc fc fc fc fc 00 01 fc fc fc fc fc fc ffff88809198f980: 00 00 00 00 fc fc fc fc 05 fc fc fc fc fc fc fc ==================================================================