================================================================== BUG: KASAN: use-after-free in crypto_aead_free_instance+0xc0/0xd0 crypto/aead.c:154 Read of size 8 at addr ffff8801c7dac4c0 by task cryptomgr_test/14806 CPU: 0 PID: 14806 Comm: cryptomgr_test Not tainted 4.15.0-rc4+ #164 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+0x194/0x257 lib/dump_stack.c:53 print_address_description+0x73/0x250 mm/kasan/report.c:252 kasan_report_error mm/kasan/report.c:351 [inline] kasan_report+0x25b/0x340 mm/kasan/report.c:409 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430 crypto_aead_free_instance+0xc0/0xd0 crypto/aead.c:154 crypto_free_instance+0x6d/0x100 crypto/algapi.c:77 crypto_destroy_instance+0x3c/0x80 crypto/algapi.c:85 crypto_alg_put crypto/internal.h:116 [inline] crypto_remove_final+0x212/0x370 crypto/algapi.c:331 crypto_alg_tested+0x445/0x6f0 crypto/algapi.c:320 cryptomgr_test+0x17/0x30 crypto/algboss.c:226 kthread+0x33c/0x400 kernel/kthread.c:238 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:515 Allocated by task 14802: save_stack+0x43/0xd0 mm/kasan/kasan.c:447 set_track mm/kasan/kasan.c:459 [inline] kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:551 kmem_cache_alloc_trace+0x136/0x750 mm/slab.c:3610 kmalloc include/linux/slab.h:499 [inline] kzalloc include/linux/slab.h:688 [inline] pcrypt_create_aead crypto/pcrypt.c:291 [inline] pcrypt_create+0x137/0x6c0 crypto/pcrypt.c:346 cryptomgr_probe+0x74/0x240 crypto/algboss.c:75 kthread+0x33c/0x400 kernel/kthread.c:238 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:515 Freed by task 3138: save_stack+0x43/0xd0 mm/kasan/kasan.c:447 set_track mm/kasan/kasan.c:459 [inline] kasan_slab_free+0x71/0xc0 mm/kasan/kasan.c:524 __cache_free mm/slab.c:3488 [inline] kfree+0xd6/0x260 mm/slab.c:3803 skb_free_head+0x74/0xb0 net/core/skbuff.c:550 skb_release_data+0x58c/0x790 net/core/skbuff.c:570 skb_release_all+0x4a/0x60 net/core/skbuff.c:627 __kfree_skb net/core/skbuff.c:641 [inline] consume_skb+0x153/0x490 net/core/skbuff.c:701 __dev_kfree_skb_any+0x85/0xa0 net/core/dev.c:2532 dev_consume_skb_any include/linux/netdevice.h:3278 [inline] free_old_xmit_skbs.isra.27+0x15a/0x2c0 drivers/net/virtio_net.c:1170 start_xmit+0x1b9/0x1650 drivers/net/virtio_net.c:1317 __netdev_start_xmit include/linux/netdevice.h:4045 [inline] netdev_start_xmit include/linux/netdevice.h:4054 [inline] xmit_one net/core/dev.c:3008 [inline] dev_hard_start_xmit+0x248/0xac0 net/core/dev.c:3024 sch_direct_xmit+0x2e0/0x920 net/sched/sch_generic.c:300 qdisc_restart net/sched/sch_generic.c:366 [inline] __qdisc_run+0x571/0x1930 net/sched/sch_generic.c:374 __dev_xmit_skb net/core/dev.c:3189 [inline] __dev_queue_xmit+0x89e/0x2200 net/core/dev.c:3489 dev_queue_xmit+0x17/0x20 net/core/dev.c:3554 neigh_hh_output include/net/neighbour.h:472 [inline] neigh_output include/net/neighbour.h:480 [inline] ip_finish_output2+0xec8/0x1460 net/ipv4/ip_output.c:229 ip_finish_output+0x85e/0xd10 net/ipv4/ip_output.c:317 NF_HOOK_COND include/linux/netfilter.h:239 [inline] ip_output+0x1cc/0x860 net/ipv4/ip_output.c:405 dst_output include/net/dst.h:443 [inline] ip_local_out+0x95/0x160 net/ipv4/ip_output.c:124 ip_queue_xmit+0x8c0/0x18e0 net/ipv4/ip_output.c:504 tcp_transmit_skb+0x1b12/0x38b0 net/ipv4/tcp_output.c:1176 tcp_write_xmit+0x680/0x5190 net/ipv4/tcp_output.c:2367 __tcp_push_pending_frames+0xa0/0x250 net/ipv4/tcp_output.c:2540 tcp_push+0x538/0x770 net/ipv4/tcp.c:728 tcp_sendmsg_locked+0x2663/0x3b30 net/ipv4/tcp.c:1422 tcp_sendmsg+0x2f/0x50 net/ipv4/tcp.c:1459 inet_sendmsg+0x11f/0x5e0 net/ipv4/af_inet.c:764 sock_sendmsg_nosec net/socket.c:628 [inline] sock_sendmsg+0xca/0x110 net/socket.c:638 sock_write_iter+0x31a/0x5d0 net/socket.c:907 call_write_iter include/linux/fs.h:1772 [inline] new_sync_write fs/read_write.c:469 [inline] __vfs_write+0x684/0x970 fs/read_write.c:482 vfs_write+0x189/0x510 fs/read_write.c:544 SYSC_write fs/read_write.c:589 [inline] SyS_write+0xef/0x220 fs/read_write.c:581 entry_SYSCALL_64_fastpath+0x1f/0x96 The buggy address belongs to the object at ffff8801c7dac4c0 which belongs to the cache kmalloc-1024 of size 1024 The buggy address is located 0 bytes inside of 1024-byte region [ffff8801c7dac4c0, ffff8801c7dac8c0) The buggy address belongs to the page: page:00000000f084d1a7 count:1 mapcount:0 mapping:00000000fcb9d527 index:0x0 compound_mapcount: 0 flags: 0x2fffc0000008100(slab|head) raw: 02fffc0000008100 ffff8801c7dac040 0000000000000000 0000000100000007 raw: ffffea00071f0620 ffffea00071f8120 ffff8801db000ac0 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8801c7dac380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8801c7dac400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8801c7dac480: fb fb fb fb fb fb fb fb fb fb fb fb 00 00 00 00 ^ ffff8801c7dac500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff8801c7dac580: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ==================================================================