1TITLE: KASAN: use-after-free Read in rdma_listen 2 3[ 353.728146] ================================================================== 4[ 353.735888] BUG: KASAN: use-after-free in __list_add_valid+0xc6/0xd0 5[ 353.742378] Read of size 8 at addr ffff8801d0d16658 by task syz-executor1/23896 6[ 353.749812] 7[ 353.751441] CPU: 0 PID: 23896 Comm: syz-executor1 Not tainted 4.16.0-rc7+ #374 8[ 353.758792] Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 9[ 353.769453] Call Trace: 10[ 353.769474] dump_stack+0x194/0x24d 11[ 353.769488] ? arch_local_irq_restore+0x53/0x53 12[ 353.769499] ? show_regs_print_info+0x18/0x18 13[ 353.769516] ? __list_add_valid+0xc6/0xd0 14[ 353.769529] print_address_description+0x73/0x250 15[ 353.769540] ? __list_add_valid+0xc6/0xd0 16[ 353.769550] kasan_report+0x23c/0x360 17[ 353.769564] __asan_report_load8_noabort+0x14/0x20 18[ 353.769573] __list_add_valid+0xc6/0xd0 19[ 353.769585] rdma_listen+0x581/0x8e0 20[ 353.769595] ? rdma_resolve_addr+0x26c0/0x26c0 21[ 353.769614] ucma_listen+0x172/0x1f0 22[ 353.769624] ? ucma_accept+0x970/0x970 23[ 353.769636] ? kasan_check_write+0x14/0x20 24[ 353.769644] ? _copy_from_user+0x99/0x110 25[ 353.769656] ucma_write+0x2d6/0x3d0 26[ 353.769665] ? ucma_accept+0x970/0x970 27[ 353.769675] ? ucma_close_id+0x60/0x60 28[ 353.769690] ? ucma_close_id+0x60/0x60 29[ 353.769699] __vfs_write+0xef/0x970 30[ 353.769713] ? kernel_read+0x120/0x120 31[ 353.769728] ? schedule+0xf5/0x430 32[ 353.769739] ? __schedule+0x1ec0/0x1ec0 33[ 353.769750] ? security_file_permission+0x89/0x1e0 34[ 353.769762] ? rw_verify_area+0xe5/0x2b0 35[ 353.769771] ? __fdget_raw+0x20/0x20 36[ 353.769783] vfs_write+0x189/0x510 37[ 353.769796] SyS_write+0xef/0x220 38[ 353.769806] ? exit_to_usermode_loop+0x198/0x2f0 39[ 353.769818] ? SyS_read+0x220/0x220 40[ 353.769828] ? do_syscall_64+0xb7/0x940 41[ 353.769840] ? SyS_read+0x220/0x220 42[ 353.769850] do_syscall_64+0x281/0x940 43[ 353.769860] ? vmalloc_sync_all+0x30/0x30 44[ 353.769869] ? _raw_spin_unlock_irq+0x27/0x70 45[ 353.769879] ? finish_task_switch+0x1c1/0x7e0 46[ 353.769889] ? syscall_return_slowpath+0x550/0x550 47[ 353.769900] ? syscall_return_slowpath+0x2ac/0x550 48[ 353.769910] ? prepare_exit_to_usermode+0x350/0x350 49[ 353.769922] ? entry_SYSCALL_64_after_hwframe+0x52/0xb7 50[ 353.769936] ? trace_hardirqs_off_thunk+0x1a/0x1c 51[ 353.769951] entry_SYSCALL_64_after_hwframe+0x42/0xb7 52[ 353.769958] RIP: 0033:0x454e79 53[ 353.769962] RSP: 002b:00007f72f952ec68 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 54[ 353.769972] RAX: ffffffffffffffda RBX: 00007f72f952f6d4 RCX: 0000000000454e79 55[ 353.769978] RDX: 0000000000000010 RSI: 0000000020000000 RDI: 0000000000000016 56[ 353.769984] RBP: 000000000072bea0 R08: 0000000000000000 R09: 0000000000000000 57[ 353.769991] R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff 58[ 353.769996] R13: 00000000000006b7 R14: 00000000006fc1c8 R15: 0000000000000000 59[ 353.770012] 60[ 353.770018] Allocated by task 23659: 61[ 353.770029] save_stack+0x43/0xd0 62[ 353.770038] kasan_kmalloc+0xad/0xe0 63[ 353.770047] __kmalloc_node_track_caller+0x47/0x70 64[ 353.770059] __kmalloc_reserve.isra.39+0x41/0xd0 65[ 353.770067] __alloc_skb+0x13b/0x780 66[ 353.770076] tcp_v6_send_response+0x215/0x1c30 67[ 353.770083] tcp_v6_send_reset+0x6fe/0xff0 68[ 353.770090] tcp_v6_rcv+0x1c56/0x2d70 69[ 353.770097] ip6_input_finish+0x37e/0x17a0 70[ 353.770103] ip6_input+0xdb/0x560 71[ 353.770111] ip6_rcv_finish+0x297/0x8c0 72[ 353.770117] ipv6_rcv+0xf38/0x1fb0 73[ 353.770126] __netif_receive_skb_core+0x1a41/0x3460 74[ 353.770133] __netif_receive_skb+0x2c/0x1b0 75[ 353.770140] process_backlog+0x203/0x740 76[ 353.770147] net_rx_action+0x792/0x1910 77[ 353.770155] __do_softirq+0x2d7/0xb85 78[ 353.770158] 79[ 353.770162] Freed by task 23659: 80[ 353.770169] save_stack+0x43/0xd0 81[ 353.770177] __kasan_slab_free+0x11a/0x170 82[ 353.770184] kasan_slab_free+0xe/0x10 83[ 353.770191] kfree+0xd9/0x260 84[ 353.770199] skb_free_head+0x74/0xb0 85[ 353.770206] skb_release_data+0x58c/0x790 86[ 353.770213] skb_release_all+0x4a/0x60 87[ 353.770219] __kfree_skb+0x15/0x20 88[ 353.770227] tcp_drop+0xcf/0x100 89[ 353.770237] tcp_rcv_state_process+0xb86/0x4920 90[ 353.770244] tcp_v6_do_rcv+0x739/0x1250 91[ 353.770259] __release_sock+0x124/0x360 92[ 353.770270] release_sock+0xa4/0x2a0 93[ 353.770280] __inet_stream_connect+0x651/0xf00 94[ 353.770290] tcp_sendmsg_locked+0x264e/0x3c70 95[ 353.770299] tcp_sendmsg+0x2f/0x50 96[ 353.770307] inet_sendmsg+0x11f/0x5e0 97[ 353.770314] sock_sendmsg+0xca/0x110 98[ 353.770322] SYSC_sendto+0x361/0x5c0 99[ 353.770328] SyS_sendto+0x40/0x50 100[ 353.770337] do_syscall_64+0x281/0x940 101[ 353.770346] entry_SYSCALL_64_after_hwframe+0x42/0xb7 102[ 353.770349] 103[ 353.770356] The buggy address belongs to the object at ffff8801d0d16480 104[ 353.770356] which belongs to the cache kmalloc-1024 of size 1024 105[ 353.770364] The buggy address is located 472 bytes inside of 106[ 353.770364] 1024-byte region [ffff8801d0d16480, ffff8801d0d16880) 107[ 353.770367] The buggy address belongs to the page: 108[ 353.770375] page:ffffea0007434580 count:1 mapcount:0 mapping:ffff8801d0d16000 index:0x0 compound_mapcount: 0 109[ 353.770388] flags: 0x2fffc0000008100(slab|head) 110[ 353.770400] raw: 02fffc0000008100 ffff8801d0d16000 0000000000000000 0000000100000007 111[ 353.770411] raw: ffffea0006b2d5a0 ffffea00070c3920 ffff8801dac00ac0 0000000000000000 112[ 353.770415] page dumped because: kasan: bad access detected 113[ 353.770418] 114[ 353.770421] Memory state around the buggy address: 115[ 353.770428] ffff8801d0d16500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb 116[ 353.770435] ffff8801d0d16580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb 117[ 353.770441] >ffff8801d0d16600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb 118[ 353.770446] ^ 119[ 353.770452] ffff8801d0d16680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb 120[ 353.770459] ffff8801d0d16700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb 121[ 353.770463] ================================================================== 122