================================================================== BUG: KASAN: slab-out-of-bounds in pfkey_msg2xfrm_state net/key/af_key.c:1227 [inline] BUG: KASAN: slab-out-of-bounds in pfkey_add+0x145d/0x3220 net/key/af_key.c:1506 Read of size 512 at addr ffff88009afbf1c0 by task syz-executor3/13573 CPU: 0 PID: 13573 Comm: syz-executor3 Not tainted 4.4.136-ge4798d7 #60 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 0000000000000000 6c64b79ddc69c31f ffff8801cdda7740 ffffffff81e0edad ffffea00026bef80 ffff88009afbf1c0 0000000000000000 ffff88009afbf380 ffff88009afbf180 ffff8801cdda7778 ffffffff815159b6 ffff88009afbf1c0 Call Trace: [] __dump_stack lib/dump_stack.c:15 [inline] [] dump_stack+0xc1/0x124 lib/dump_stack.c:51 [] print_address_description+0x6c/0x216 mm/kasan/report.c:252 [] kasan_report_error mm/kasan/report.c:351 [inline] [] kasan_report.cold.7+0x175/0x2f7 mm/kasan/report.c:408 [] check_memory_region_inline mm/kasan/kasan.c:325 [inline] [] check_memory_region+0x14f/0x1b0 mm/kasan/kasan.c:332 [] memcpy+0x23/0x50 mm/kasan/kasan.c:367 [] pfkey_msg2xfrm_state net/key/af_key.c:1227 [inline] [] pfkey_add+0x145d/0x3220 net/key/af_key.c:1506 [] pfkey_process+0x671/0x740 net/key/af_key.c:2834 [] pfkey_sendmsg+0x346/0xae0 net/key/af_key.c:3678 [] sock_sendmsg_nosec net/socket.c:625 [inline] [] sock_sendmsg+0xcc/0x110 net/socket.c:635 [] ___sys_sendmsg+0x745/0x880 net/socket.c:1962 [] __sys_sendmsg+0xd6/0x190 net/socket.c:1996 [] SYSC_sendmsg net/socket.c:2007 [inline] [] SyS_sendmsg+0x2d/0x50 net/socket.c:2003 [] entry_SYSCALL_64_fastpath+0x22/0x9e Allocated by task 13573: [] save_stack_trace+0x26/0x50 arch/x86/kernel/stacktrace.c:63 [] save_stack+0x43/0xd0 mm/kasan/kasan.c:512 [] set_track mm/kasan/kasan.c:524 [inline] [] kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:616 [] kasan_krealloc+0x64/0x80 mm/kasan/kasan.c:654 [] ksize+0x8a/0xf0 mm/slub.c:3727 [] __alloc_skb+0x133/0x600 net/core/skbuff.c:237 [] alloc_skb include/linux/skbuff.h:815 [inline] [] pfkey_sendmsg+0xfe/0xae0 net/key/af_key.c:3665 [] sock_sendmsg_nosec net/socket.c:625 [inline] [] sock_sendmsg+0xcc/0x110 net/socket.c:635 [] ___sys_sendmsg+0x745/0x880 net/socket.c:1962 [] __sys_sendmsg+0xd6/0x190 net/socket.c:1996 [] SYSC_sendmsg net/socket.c:2007 [inline] [] SyS_sendmsg+0x2d/0x50 net/socket.c:2003 [] entry_SYSCALL_64_fastpath+0x22/0x9e Freed by task 12405: [] save_stack_trace+0x26/0x50 arch/x86/kernel/stacktrace.c:63 [] save_stack+0x43/0xd0 mm/kasan/kasan.c:512 [] set_track mm/kasan/kasan.c:524 [inline] [] kasan_slab_free+0x72/0xc0 mm/kasan/kasan.c:589 [] slab_free_hook mm/slub.c:1383 [inline] [] slab_free_freelist_hook mm/slub.c:1405 [inline] [] slab_free mm/slub.c:2859 [inline] [] kfree+0xf4/0x310 mm/slub.c:3749 [] skb_free_head net/core/skbuff.c:571 [inline] [] skb_release_data+0x304/0x3b0 net/core/skbuff.c:602 [] skb_release_all+0x4a/0x60 net/core/skbuff.c:661 [] __kfree_skb net/core/skbuff.c:675 [inline] [] consume_skb+0xf3/0x3d0 net/core/skbuff.c:748 [] netlink_broadcast_filtered+0x2b2/0x9c0 net/netlink/af_netlink.c:1479 [] kobject_uevent_env+0x6d8/0xb80 lib/kobject_uevent.c:316 [] kobject_uevent+0x1f/0x30 lib/kobject_uevent.c:374 [] kobject_cleanup lib/kobject.c:630 [inline] [] kobject_release+0x144/0x1b0 lib/kobject.c:672 [] kref_sub include/linux/kref.h:73 [inline] [] kref_put include/linux/kref.h:98 [inline] [] kobject_put+0x72/0xd0 lib/kobject.c:689 [] netdev_queue_update_kobjects+0x18d/0x290 net/core/net-sysfs.c:1327 [] netif_set_real_num_tx_queues+0x187/0x620 net/core/dev.c:2198 [] tun_set_real_num_queues drivers/net/tun.c:482 [inline] [] __tun_detach+0x6b0/0xa10 drivers/net/tun.c:536 [] tun_detach drivers/net/tun.c:557 [inline] [] tun_chr_close+0x44/0x60 drivers/net/tun.c:2261 [] __fput+0x235/0x6f0 fs/file_table.c:208 [] ____fput+0x15/0x20 fs/file_table.c:244 [] task_work_run+0x10f/0x190 kernel/task_work.c:115 [] exit_task_work include/linux/task_work.h:21 [inline] [] do_exit+0x9e5/0x26b0 kernel/exit.c:759 [] do_group_exit+0x111/0x330 kernel/exit.c:889 [] get_signal+0x4ec/0x14b0 kernel/signal.c:2321 [] do_signal+0x8b/0x1d30 arch/x86/kernel/signal.c:712 [] exit_to_usermode_loop+0x11a/0x160 arch/x86/entry/common.c:248 [] prepare_exit_to_usermode arch/x86/entry/common.c:283 [inline] [] syscall_return_slowpath+0x1b5/0x1f0 arch/x86/entry/common.c:348 [] int_ret_from_sys_call+0x25/0xa3 The buggy address belongs to the object at ffff88009afbf180 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 64 bytes inside of 512-byte region [ffff88009afbf180, ffff88009afbf380) The buggy address belongs to the page: kasan: CONFIG_KASAN_INLINE enabled kasan: GPF could be caused by NULL-ptr deref or user memory accessgeneral protection fault: 0000 [#1] PREEMPT SMP KASAN Dumping ftrace buffer: (ftrace buffer empty) Modules linked in: CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.4.136-ge4798d7 #60 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 task: ffff8801d9a41800 task.stack: ffff8801d9a50000 RIP: 0010:[] [] __rb_insert lib/rbtree.c:120 [inline] RIP: 0010:[] [] rb_insert_color+0xa0/0xca0 lib/rbtree.c:420 RSP: 0018:ffff8801db307ce0 EFLAGS: 00010003 RAX: 0a0508a8e82a0be9 RBX: ffffffff83aa9ee0 RCX: ffffffff83aa9ee0 RDX: 1ffffffff07553dd RSI: ffff8801db319710 RDI: ffff8801db319c40 RBP: ffff8801db307d20 R08: 0000000000000096 R09: 0000000000000001 R10: 0000000000000000 R11: ffff8801d9a41800 R12: ffff8801c8ef7b08 R13: ffff8801db319c40 R14: 5028454741505f4e R15: dffffc0000000000 FS: 0000000000000000(0000) GS:ffff8801db300000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fca5c62d000 CR3: 00000000b619b000 CR4: 00000000001606f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Stack: ffffffff844bdba0 0000000000000000 ffff8801db307d30 ffff8801db319c40 dffffc0000000000 0000000000000000 ffff8801db319710 ffff8801c8ef7b10 ffff8801db307d70 ffffffff81e2c7b7 ffff8801db319c58 ffff8801db319710 Call Trace: [] timerqueue_add+0x157/0x2b0 lib/timerqueue.c:57 [] enqueue_hrtimer+0x15f/0x440 kernel/time/hrtimer.c:893 [] __run_hrtimer kernel/time/hrtimer.c:1276 [inline] [] __hrtimer_run_queues+0x6b2/0x1000 kernel/time/hrtimer.c:1325 [] hrtimer_interrupt+0x1b1/0x430 kernel/time/hrtimer.c:1359 [] local_apic_timer_interrupt+0x74/0xa0 arch/x86/kernel/apic/apic.c:901 [] smp_apic_timer_interrupt+0x7c/0xa0 arch/x86/kernel/apic/apic.c:925 [] apic_timer_interrupt+0xa0/0xb0 arch/x86/entry/entry_64.S:741 [] arch_safe_halt arch/x86/include/asm/paravirt.h:117 [inline] [] default_idle+0x55/0x3c0 arch/x86/kernel/process.c:290 [] arch_cpu_idle+0x10/0x20 arch/x86/kernel/process.c:281 [] default_idle_call+0x57/0x70 kernel/sched/idle.c:93 [] cpuidle_idle_call kernel/sched/idle.c:157 [inline] [] cpu_idle_loop kernel/sched/idle.c:253 [inline] [] cpu_startup_entry+0x6af/0x780 kernel/sched/idle.c:301 [] start_secondary+0x324/0x400 arch/x86/kernel/smpboot.c:242 Code: 48 89 c2 48 c1 ea 03 42 80 3c 3a 00 0f 85 c5 06 00 00 4c 8b 73 08 4d 39 e6 0f 84 85 01 00 00 4d 85 f6 74 1c 4c 89 f0 48 c1 e8 03 <42> 80 3c 38 00 0f 85 56 07 00 00 41 f6 06 01 0f 84 0a 05 00 00 RIP [] __rb_insert lib/rbtree.c:120 [inline] RIP [] rb_insert_color+0xa0/0xca0 lib/rbtree.c:420 RSP ---[ end trace 2b1fae10725f2929 ]---