KASAN: use-after-free Read in sk_psock_unlink
Status: upstream: reported syz repro on 2018/10/26 07:37
First crash: 1308d, last: 859d

Cause bisection: introduced by (bisect log) :
commit 48a3c64b4649b5b23a4ca756af93b4ee820ff883
Author: Linus Torvalds <>
Date: Fri Jun 29 14:11:03 2018 +0000

  Merge tag 'drm-fixes-2018-06-29' of git://

Crash: general protection fault in bpf_tcp_close (log)
Repro: syz .config

Fix bisection: failed (bisect log)

Sample crash report:
BUG: KASAN: use-after-free in sk_psock_unlink+0x370/0x440 net/core/sock_map.c:1000
Read of size 4 at addr ffff88809fac7c18 by task syz-executor.0/21304

CPU: 1 PID: 21304 Comm: syz-executor.0 Not tainted 5.5.0-rc6-syzkaller #0
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+0x197/0x210 lib/dump_stack.c:118
 print_address_description.constprop.0.cold+0xd4/0x30b mm/kasan/report.c:374
 __kasan_report.cold+0x1b/0x41 mm/kasan/report.c:506
 kasan_report+0x12/0x20 mm/kasan/common.c:639
 __asan_report_load4_noabort+0x14/0x20 mm/kasan/generic_report.c:134
 sk_psock_unlink+0x370/0x440 net/core/sock_map.c:1000
 tcp_bpf_remove+0x21/0x50 net/ipv4/tcp_bpf.c:539
 tcp_bpf_close+0x130/0x390 net/ipv4/tcp_bpf.c:579
 inet_release+0xed/0x200 net/ipv4/af_inet.c:427
 inet6_release+0x53/0x80 net/ipv6/af_inet6.c:470
 __sock_release+0xce/0x280 net/socket.c:592
 sock_close+0x1e/0x30 net/socket.c:1270
 __fput+0x2ff/0x890 fs/file_table.c:280
 ____fput+0x16/0x20 fs/file_table.c:313
 task_work_run+0x145/0x1c0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:188 [inline]
 exit_to_usermode_loop+0x316/0x380 arch/x86/entry/common.c:164
 prepare_exit_to_usermode arch/x86/entry/common.c:195 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:278 [inline]
 do_syscall_64+0x676/0x790 arch/x86/entry/common.c:304
RIP: 0033:0x414b91
Code: 75 14 b8 03 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 04 1b 00 00 c3 48 83 ec 08 e8 0a fc ff ff 48 89 04 24 b8 03 00 00 00 0f 05 <48> 8b 3c 24 48 89 c2 e8 53 fc ff ff 48 89 d0 48 83 c4 08 48 3d 01
RSP: 002b:00007ffd563b6120 EFLAGS: 00000293 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 0000000000000006 RCX: 0000000000414b91
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000005
RBP: 0000000000000001 R08: ffffffffffffffff R09: ffffffffffffffff
R10: 00007ffd563b6200 R11: 0000000000000293 R12: 000000000075bf20
R13: 00000000000471f2 R14: 00000000007610a8 R15: 000000000075bf2c

Allocated by task 21306:
 save_stack+0x23/0x90 mm/kasan/common.c:72
 set_track mm/kasan/common.c:80 [inline]
 __kasan_kmalloc mm/kasan/common.c:513 [inline]
 __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:486
 kasan_kmalloc+0x9/0x10 mm/kasan/common.c:527
 kmem_cache_alloc_trace+0x158/0x790 mm/slab.c:3551
 kmalloc include/linux/slab.h:556 [inline]
 kzalloc include/linux/slab.h:670 [inline]
 sock_hash_alloc net/core/sock_map.c:809 [inline]
 sock_hash_alloc+0x1e3/0x5b0 net/core/sock_map.c:793
 find_and_alloc_map kernel/bpf/syscall.c:123 [inline]
 map_create kernel/bpf/syscall.c:654 [inline]
 __do_sys_bpf+0x478/0x3810 kernel/bpf/syscall.c:3012
 __se_sys_bpf kernel/bpf/syscall.c:2989 [inline]
 __x64_sys_bpf+0x73/0xb0 kernel/bpf/syscall.c:2989
 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294

Freed by task 2749:
 save_stack+0x23/0x90 mm/kasan/common.c:72
 set_track mm/kasan/common.c:80 [inline]
 kasan_set_free_info mm/kasan/common.c:335 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/common.c:474
 kasan_slab_free+0xe/0x10 mm/kasan/common.c:483
 __cache_free mm/slab.c:3426 [inline]
 kfree+0x10a/0x2c0 mm/slab.c:3757
 sock_hash_free+0x322/0x490 net/core/sock_map.c:872
 bpf_map_free_deferred+0xb3/0x100 kernel/bpf/syscall.c:327
 process_one_work+0x9af/0x1740 kernel/workqueue.c:2264
 worker_thread+0x98/0xe40 kernel/workqueue.c:2410
 kthread+0x361/0x430 kernel/kthread.c:255
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352

The buggy address belongs to the object at ffff88809fac7c00
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 24 bytes inside of
 512-byte region [ffff88809fac7c00, ffff88809fac7e00)
The buggy address belongs to the page:
page:ffffea00027eb1c0 refcount:1 mapcount:0 mapping:ffff8880aa400a80 index:0xffff88809fac7400
raw: 00fffe0000000200 ffffea00029fd748 ffffea000277f608 ffff8880aa400a80
raw: ffff88809fac7400 ffff88809fac7000 0000000100000003 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88809fac7b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88809fac7b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88809fac7c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88809fac7c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88809fac7d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb

Crashes (84):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce-selinux-root 2020/01/18 01:09 upstream ab7541c3addd 3de7aabb .config log report syz
ci-upstream-kasan-gce-selinux-root 2019/09/13 19:01 upstream 505a8ec7e11a 40fa42bc .config log report syz
ci-upstream-kasan-gce-root 2019/08/07 05:23 upstream f4eb1423e433 c6f01e54 .config log report syz
ci-upstream-kasan-gce-selinux-root 2019/08/07 04:44 upstream f4eb1423e433 c6f01e54 .config log report syz
ci-upstream-kasan-gce-smack-root 2019/08/07 02:38 upstream f4eb1423e433 c6f01e54 .config log report syz
ci-upstream-kasan-gce-root 2019/07/31 20:57 upstream 4010b622f1d2 c692b5bd .config log report syz
ci-upstream-kasan-gce-selinux-root 2019/07/31 20:33 upstream 4010b622f1d2 c692b5bd .config log report syz
ci-upstream-kasan-gce-smack-root 2019/07/31 13:42 upstream 629f8205a6cc 7c7ded69 .config log report syz
ci-upstream-kasan-gce-root 2019/07/26 08:18 upstream 6789f873ed37 732bc5a0 .config log report syz
ci-upstream-kasan-gce-root 2019/07/19 08:57 upstream 3bfe1fc46794 7bb222f7 .config log report syz
ci-upstream-kasan-gce-selinux-root 2019/07/13 00:41 upstream d7d170a8e357 baa5258a .config log report syz
ci-upstream-kasan-gce-smack-root 2019/07/10 13:26 upstream e9a83bd23220 f62e1e85 .config log report syz
ci-upstream-kasan-gce-selinux-root 2019/07/01 22:00 upstream 6fbc7275c7a9 907bf746 .config log report syz
ci-upstream-kasan-gce-root 2019/07/01 20:47 upstream 6fbc7275c7a9 907bf746 .config log report syz
ci-upstream-kasan-gce-root 2019/07/01 09:14 upstream 6fbc7275c7a9 699d6448 .config log report syz
ci-upstream-kasan-gce-selinux-root 2019/06/26 09:08 upstream 249155c20f9b 0a8d1a96 .config log report syz
ci-upstream-kasan-gce-selinux-root 2019/06/21 15:30 upstream abf02e2964b3 34bf9440 .config log report syz
ci-upstream-kasan-gce-selinux-root 2019/06/19 03:59 upstream 29f785ff76b6 e3f76baa .config log report syz
ci-upstream-kasan-gce-selinux-root 2019/06/18 05:54 upstream 9e0babf2c06c 442206d7 .config log report syz
ci-upstream-kasan-gce-smack-root 2019/06/16 13:14 upstream e01e060fe00d 442206d7 .config log report syz
ci-upstream-kasan-gce-smack-root 2019/06/11 21:52 upstream 01ccc3ad4413 5b5826d0 .config log report syz
ci-upstream-net-this-kasan-gce 2019/07/31 10:44 net 107e47cc80ec 7c7ded69 .config log report syz
ci-upstream-net-this-kasan-gce 2019/07/27 16:15 net 107e47cc80ec c85e1c5b .config log report syz
ci-upstream-net-this-kasan-gce 2019/06/26 06:00 net 904d88d743b0 0a8d1a96 .config log report syz
ci-upstream-net-this-kasan-gce 2019/06/16 10:37 net ef7bfa84725d 442206d7 .config log report syz
ci-upstream-net-this-kasan-gce 2019/06/15 12:35 net 35fc07aee8f6 442206d7 .config log report syz
ci-upstream-net-this-kasan-gce 2019/06/11 13:28 net dce5ccccd123 5b5826d0 .config log report syz
ci-upstream-net-this-kasan-gce 2019/06/05 17:50 net f4cfcfbdf03c bfb4a51e .config log report syz
ci-upstream-net-this-kasan-gce 2019/05/25 10:52 net ce8d24f9a596 85c57315 .config log report syz
ci-upstream-net-kasan-gce 2020/01/17 15:04 net-next 6bc803803526 3de7aabb .config log report syz
ci-upstream-net-kasan-gce 2019/10/13 08:33 net-next 524900a212f4 426631dd .config log report syz
ci-upstream-net-kasan-gce 2019/09/17 04:42 net-next 990925fad5c2 51ca0454 .config log report syz
ci-upstream-net-kasan-gce 2019/07/18 23:50 net-next 192f0f8e9db7 7bb222f7 .config log report syz
ci-upstream-net-kasan-gce 2019/06/25 11:55 net-next 7d30a7f6424e 82c13b6b .config log report syz
ci-upstream-net-kasan-gce 2019/05/22 14:44 net-next f49aa1de9836 84b9d384 .config log report syz
ci-upstream-linux-next-kasan-gce-root 2019/09/01 18:45 linux-next 6d028043b55e bad3cce2 .config log report syz
ci-upstream-linux-next-kasan-gce-root 2019/08/20 17:43 linux-next 54c851a8cc73 cfc9868f .config log report syz
ci-upstream-linux-next-kasan-gce-root 2019/07/31 19:49 linux-next ce96e791d6a7 c692b5bd .config log report syz
ci-upstream-linux-next-kasan-gce-root 2019/06/28 19:53 linux-next 48568d8c7f47 7509bf36 .config log report syz
ci-upstream-linux-next-kasan-gce-root 2019/06/25 03:52 linux-next 9ffadb46f3db 82c13b6b .config log report syz
ci-upstream-linux-next-kasan-gce-root 2019/06/15 22:27 linux-next f4788d37bc84 442206d7 .config log report syz
ci-upstream-kasan-gce-selinux-root 2020/01/16 11:29 upstream f5ae2ea6347a f9b69507 .config log report
ci-upstream-kasan-gce-selinux-root 2020/01/08 01:33 upstream ae6088216ce4 6738e0b3 .config log report
ci-upstream-kasan-gce-selinux-root 2019/10/25 06:34 upstream 39a38bcba4ab d01bb02a .config log report
ci-upstream-kasan-gce-selinux-root 2019/09/20 12:58 upstream 574cc4539762 d96e88f3 .config log report
ci-upstream-kasan-gce-selinux-root 2019/08/10 11:09 upstream 7f20fd23377a acb51638 .config log report
ci-upstream-kasan-gce-root 2019/07/29 08:31 upstream a9815a4fa2fd c85e1c5b .config log report
ci-upstream-kasan-gce-smack-root 2019/06/30 01:40 upstream 728254541ebc 7509bf36 .config log report
ci-upstream-kasan-gce-smack-root 2019/06/27 10:44 upstream 249155c20f9b 7509bf36 .config log report
ci-upstream-kasan-gce-selinux-root 2019/06/23 09:44 upstream abf02e2964b3 34bf9440 .config log report
ci-upstream-kasan-gce-selinux-root 2019/06/22 23:22 upstream abf02e2964b3 34bf9440 .config log report
ci-upstream-kasan-gce-smack-root 2019/06/22 17:11 upstream abf02e2964b3 34bf9440 .config log report
ci-upstream-kasan-gce-root 2019/06/22 13:32 upstream abf02e2964b3 34bf9440 .config log report
ci-upstream-kasan-gce-root 2019/06/22 09:58 upstream abf02e2964b3 34bf9440 .config log report
ci-upstream-kasan-gce-selinux-root 2019/06/19 07:34 upstream bed3c0d84e7e 34bf9440 .config log report
ci-upstream-kasan-gce-smack-root 2019/06/17 14:56 upstream 9e0babf2c06c 442206d7 .config log report
ci-upstream-kasan-gce-smack-root 2019/06/09 17:00 upstream d1fdb6d8f6a4 0159583c .config log report
ci-upstream-kasan-gce-smack-root 2019/06/04 16:06 upstream 788a024921c4 e41a20c5 .config log report
ci-upstream-kasan-gce-smack-root 2019/06/04 08:04 upstream 788a024921c4 ce07a7ae .config log report
ci-upstream-kasan-gce-selinux-root 2019/05/27 10:44 upstream cd6c84d8f0cd 562efd79 .config log report
ci-upstream-kasan-gce-selinux-root 2019/01/20 13:41 upstream 6e693b3ffecb 353f32ea .config log report
ci-upstream-kasan-gce-smack-root 2018/12/14 10:51 upstream 65e08c5e8631 fe7127be .config log report
ci-upstream-kasan-gce-smack-root 2018/12/02 04:15 upstream 4b78317679c4 5a581673 .config log report
ci-upstream-kasan-gce-selinux-root 2018/11/27 00:56 upstream 6f8b52ba442c ac912200 .config log report
ci-upstream-kasan-gce-root 2018/11/14 12:30 upstream ccda4af0f4b9 5f5f6d14 .config log report
ci-upstream-kasan-gce-root 2018/11/14 07:52 upstream ccda4af0f4b9 5f5f6d14 .config log report
ci-upstream-net-this-kasan-gce 2019/07/10 21:18 net e858faf556d4 ff7bf04c .config log report
ci-upstream-net-kasan-gce 2019/09/04 20:28 net-next 2c1f9e263444 040fda58 .config log report
ci-upstream-net-kasan-gce 2019/08/29 23:08 net-next d00ee466a07e fd37b39e .config log report
ci-upstream-net-kasan-gce 2019/06/08 13:19 net-next a6cdeeb16bff cf9c3a50 .config log report
ci-upstream-linux-next-kasan-gce-root 2019/11/07 10:06 linux-next c68c5373c504 d797d201 .config log report
ci-upstream-linux-next-kasan-gce-root 2019/09/22 08:33 linux-next b5b3bd898ba9 d96e88f3 .config log report
ci-upstream-linux-next-kasan-gce-root 2019/08/31 02:30 linux-next ed2393ca0910 fd37b39e .config log report
ci-upstream-linux-next-kasan-gce-root 2019/07/12 12:31 linux-next 2c51253c1714 baa5258a .config log report
ci-upstream-linux-next-kasan-gce-root 2019/07/01 13:45 linux-next 48a8a5f9a326 907bf746 .config log report
ci-upstream-linux-next-kasan-gce-root 2019/06/26 05:24 linux-next 902031767aec 0a8d1a96 .config log report
ci-upstream-linux-next-kasan-gce-root 2019/06/22 06:29 linux-next dc636f5d78de 34bf9440 .config log report
ci-upstream-linux-next-kasan-gce-root 2019/06/20 17:31 linux-next dc636f5d78de 34bf9440 .config log report
ci-upstream-linux-next-kasan-gce-root 2019/06/18 01:45 linux-next a125097c8410 442206d7 .config log report
ci-upstream-linux-next-kasan-gce-root 2019/06/16 08:30 linux-next f4788d37bc84 442206d7 .config log report
ci-upstream-linux-next-kasan-gce-root 2019/06/10 06:59 linux-next 3f310e51ceb1 0159583c .config log report
ci-upstream-linux-next-kasan-gce-root 2019/06/08 02:13 linux-next 3f310e51ceb1 cf9c3a50 .config log report
ci-upstream-linux-next-kasan-gce-root 2018/12/08 09:08 linux-next 74c4a24df7ca 65ed2472 .config log report
ci-upstream-linux-next-kasan-gce-root 2018/10/25 20:12 linux-next 8c60c36d0b8c a8292de9 .config log report