================================================================== BUG: KASAN: use-after-free in __xfrm_policy_eval_candidates net/xfrm/xfrm_policy.c:2019 [inline] BUG: KASAN: use-after-free in xfrm_policy_eval_candidates net/xfrm/xfrm_policy.c:2053 [inline] BUG: KASAN: use-after-free in xfrm_policy_lookup_bytype+0xd27/0xdb0 net/xfrm/xfrm_policy.c:2113 Read of size 4 at addr ffff888067f0d774 by task syz-executor4/3540 CPU: 1 PID: 3540 Comm: syz-executor4 Not tainted 4.20.0+ #9 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x1db/0x2d0 lib/dump_stack.c:113 print_address_description.cold+0x7c/0x20d mm/kasan/report.c:187 kasan_report.cold+0x1b/0x40 mm/kasan/report.c:317 __asan_report_load4_noabort+0x14/0x20 mm/kasan/generic_report.c:134 __xfrm_policy_eval_candidates net/xfrm/xfrm_policy.c:2019 [inline] xfrm_policy_eval_candidates net/xfrm/xfrm_policy.c:2053 [inline] xfrm_policy_lookup_bytype+0xd27/0xdb0 net/xfrm/xfrm_policy.c:2113 xfrm_policy_lookup+0x7e/0x90 net/xfrm/xfrm_policy.c:2145 xfrm_bundle_lookup net/xfrm/xfrm_policy.c:2939 [inline] xfrm_lookup_with_ifid+0x8cf/0x2a90 net/xfrm/xfrm_policy.c:3080 xfrm_lookup net/xfrm/xfrm_policy.c:3172 [inline] xfrm_lookup_route+0x3b/0x1f0 net/xfrm/xfrm_policy.c:3183 ip_route_output_flow+0xad/0xc0 net/ipv4/route.c:2582 ip_route_output_key include/net/route.h:134 [inline] ip_tunnel_xmit+0x8d2/0x3b3c net/ipv4/ip_tunnel.c:717 __gre_xmit+0x5e9/0x9a0 net/ipv4/ip_gre.c:453 ipgre_xmit+0x5b0/0xd60 net/ipv4/ip_gre.c:710 __netdev_start_xmit include/linux/netdevice.h:4382 [inline] netdev_start_xmit include/linux/netdevice.h:4391 [inline] xmit_one net/core/dev.c:3278 [inline] dev_hard_start_xmit+0x261/0xc70 net/core/dev.c:3294 __dev_queue_xmit+0x2f8a/0x3a60 net/core/dev.c:3864 dev_queue_xmit+0x18/0x20 net/core/dev.c:3897 packet_snd net/packet/af_packet.c:2932 [inline] packet_sendmsg+0x2753/0x6830 net/packet/af_packet.c:2957 sock_sendmsg_nosec net/socket.c:621 [inline] sock_sendmsg+0xdd/0x130 net/socket.c:631 ___sys_sendmsg+0x7ec/0x910 net/socket.c:2116 kernel msg: ebtables bug: please report to author: EBT_ENTRY_OR_ENTRIES shouldn't be set in distinguisher kernel msg: ebtables bug: please report to author: EBT_ENTRY_OR_ENTRIES shouldn't be set in distinguisher __sys_sendmsg+0x112/0x270 net/socket.c:2154 __do_sys_sendmsg net/socket.c:2163 [inline] __se_sys_sendmsg net/socket.c:2161 [inline] __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2161 do_syscall_64+0x1a3/0x800 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x457ec9 Code: 6d b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 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 0f 83 3b b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007f95a1534c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000457ec9 RDX: 0000000000000000 RSI: 0000000020000100 RDI: 000000000000000c RBP: 000000000073bfa0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007f95a15356d4 R13: 00000000004c52f9 R14: 00000000004d8d58 R15: 00000000ffffffff Allocated by task 3175: save_stack+0x45/0xd0 mm/kasan/common.c:73 set_track mm/kasan/common.c:85 [inline] kasan_kmalloc mm/kasan/common.c:482 [inline] kasan_kmalloc+0xcf/0xe0 mm/kasan/common.c:455 __do_kmalloc mm/slab.c:3709 [inline] __kmalloc+0x15c/0x740 mm/slab.c:3718 kmalloc include/linux/slab.h:550 [inline] sock_kmalloc net/core/sock.c:1992 [inline] sock_kmalloc+0x166/0x200 net/core/sock.c:1983 af_alg_get_rsgl+0x15d/0x900 crypto/af_alg.c:1148 _skcipher_recvmsg crypto/algif_skcipher.c:81 [inline] skcipher_recvmsg+0x336/0x1260 crypto/algif_skcipher.c:165 sock_recvmsg_nosec+0x8c/0xb0 net/socket.c:794 ___sys_recvmsg+0x2a8/0x670 net/socket.c:2278 do_recvmmsg+0x2f8/0xba0 net/socket.c:2391 __sys_recvmmsg+0x259/0x270 net/socket.c:2470 __do_sys_recvmmsg net/socket.c:2493 [inline] __se_sys_recvmmsg net/socket.c:2486 [inline] __x64_sys_recvmmsg+0xe6/0x140 net/socket.c:2486 do_syscall_64+0x1a3/0x800 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 3175: save_stack+0x45/0xd0 mm/kasan/common.c:73 set_track mm/kasan/common.c:85 [inline] __kasan_slab_free+0x102/0x150 mm/kasan/common.c:444 kasan_slab_free+0xe/0x10 mm/kasan/common.c:452 __cache_free mm/slab.c:3485 [inline] kfree+0xcf/0x230 mm/slab.c:3804 __sock_kfree_s net/core/sock.c:2013 [inline] sock_kfree_s+0x29/0x70 net/core/sock.c:2019 af_alg_free_areq_sgls+0x514/0xad0 crypto/af_alg.c:672 af_alg_free_resources+0x39/0x90 crypto/af_alg.c:1032 _skcipher_recvmsg crypto/algif_skcipher.c:152 [inline] skcipher_recvmsg+0x9e3/0x1260 crypto/algif_skcipher.c:165 sock_recvmsg_nosec+0x8c/0xb0 net/socket.c:794 ___sys_recvmsg+0x2a8/0x670 net/socket.c:2278 do_recvmmsg+0x2f8/0xba0 net/socket.c:2391 __sys_recvmmsg+0x259/0x270 net/socket.c:2470 __do_sys_recvmmsg net/socket.c:2493 [inline] __se_sys_recvmmsg net/socket.c:2486 [inline] __x64_sys_recvmmsg+0xe6/0x140 net/socket.c:2486 do_syscall_64+0x1a3/0x800 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe The buggy address belongs to the object at ffff888067f0d6c0 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 180 bytes inside of 1024-byte region [ffff888067f0d6c0, ffff888067f0dac0) The buggy address belongs to the page: page:ffffea00019fc300 count:1 mapcount:0 mapping:ffff88812c3f0ac0 index:0xffff888067f0d240 compound_mapcount: 0 flags: 0x1fffc0000010200(slab|head) raw: 01fffc0000010200 ffffea00022b5008 ffffea0001ac8e08 ffff88812c3f0ac0 raw: ffff888067f0d240 ffff888067f0c040 0000000100000002 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888067f0d600: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff888067f0d680: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb >ffff888067f0d700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888067f0d780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888067f0d800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================