syzbot


KASAN: use-after-free Read in psock_map_pop

Status: upstream: reported C repro on 2019/05/18 22:40
Reported-by: syzbot+49725605640d0fdab643@syzkaller.appspotmail.com
First crash: 2043d, last: 658d
Fix bisection: fixed by (bisect log) [release commit]:
commit d18b78abc0c6e7d3119367c931c583e02d466495
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: Fri Aug 21 09:05:39 2020 +0000

  Linux 4.19.141

  
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in psock_map_pop bpf C done 204 2251d 2294d 13/28 fixed on 2019/10/04 12:05
Fix bisection attempts (4)
Created Duration User Patch Repo Result
2020/08/23 14:41 4h14m bisect fix linux-4.19.y OK (1) job log
2020/07/24 14:01 39m bisect fix linux-4.19.y OK (0) job log log
2020/06/24 13:22 38m bisect fix linux-4.19.y OK (0) job log log
2020/05/12 04:01 40m bisect fix linux-4.19.y OK (0) job log log

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __lock_acquire+0x2cb4/0x3ff0 kernel/locking/lockdep.c:3295
Read of size 8 at addr ffff88809bc58708 by task syz-executor201/2979

CPU: 1 PID: 2979 Comm: syz-executor201 Not tainted 4.19.211-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+0x1fc/0x2ef lib/dump_stack.c:118
 print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
 kasan_report_error.cold+0x8a/0x1b9 mm/kasan/report.c:354
 kasan_report mm/kasan/report.c:412 [inline]
 __asan_report_load8_noabort+0x88/0x90 mm/kasan/report.c:433
 __lock_acquire+0x2cb4/0x3ff0 kernel/locking/lockdep.c:3295
 lock_acquire+0x170/0x3c0 kernel/locking/lockdep.c:3908
 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:135 [inline]
 _raw_spin_lock_bh+0x2f/0x40 kernel/locking/spinlock.c:168
 spin_lock_bh include/linux/spinlock.h:334 [inline]
 psock_map_pop.constprop.0+0x28/0x1f0 kernel/bpf/sockmap.c:302
 bpf_tcp_remove+0x47d/0xa00 kernel/bpf/sockmap.c:366
 bpf_tcp_unhash+0x11c/0x380 kernel/bpf/sockmap.c:384
 tcp_set_state+0x1a8/0x7d0 net/ipv4/tcp.c:2244
 tcp_done+0xa9/0x2a0 net/ipv4/tcp.c:3789
 tcp_rcv_state_process+0x23c2/0x4c50 net/ipv4/tcp_input.c:6225
 tcp_v4_do_rcv+0x31f/0x870 net/ipv4/tcp_ipv4.c:1569
 sk_backlog_rcv include/net/sock.h:952 [inline]
 __release_sock+0x134/0x3a0 net/core/sock.c:2362
 release_sock+0x54/0x1b0 net/core/sock.c:2901
 inet_shutdown+0x1e0/0x3a0 net/ipv4/af_inet.c:889
 __sys_shutdown+0xf3/0x1a0 net/socket.c:2077
 __do_sys_shutdown net/socket.c:2085 [inline]
 __se_sys_shutdown net/socket.c:2083 [inline]
 __x64_sys_shutdown+0x50/0x70 net/socket.c:2083
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7f60e11930a9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 b1 14 00 00 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 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffc70271d48 EFLAGS: 00000246 ORIG_RAX: 0000000000000030
RAX: ffffffffffffffda RBX: 00000000000f4240 RCX: 00007f60e11930a9
RDX: 00007f60e11930a9 RSI: 0000000000000001 RDI: 0000000000000003
RBP: 0000000000000000 R08: 0000000000000010 R09: 0000000000000010
R10: 0000000000000010 R11: 0000000000000246 R12: 000000000009809b
R13: 00007ffc70271d6c R14: 00007ffc70271d80 R15: 00007ffc70271d70

Allocated by task 2979:
 kmem_cache_alloc_node_trace+0x151/0x3b0 mm/slab.c:3668
 kmalloc_node include/linux/slab.h:553 [inline]
 kzalloc_node include/linux/slab.h:720 [inline]
 smap_init_psock kernel/bpf/sockmap.c:1636 [inline]
 __sock_map_ctx_update_elem.constprop.0+0x366/0xea0 kernel/bpf/sockmap.c:1940
 sock_hash_ctx_update_elem.isra.0+0x69d/0x1100 kernel/bpf/sockmap.c:2411
 sock_hash_update_elem+0x210/0x480 kernel/bpf/sockmap.c:2495
 map_update_elem kernel/bpf/syscall.c:821 [inline]
 __do_sys_bpf kernel/bpf/syscall.c:2414 [inline]
 __se_sys_bpf+0x2cf1/0x3a20 kernel/bpf/syscall.c:2384
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 8141:
 __cache_free mm/slab.c:3503 [inline]
 kfree+0xcc/0x210 mm/slab.c:3822
 process_one_work+0x864/0x1570 kernel/workqueue.c:2153
 worker_thread+0x64c/0x1130 kernel/workqueue.c:2296
 kthread+0x33f/0x460 kernel/kthread.c:259
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

The buggy address belongs to the object at ffff88809bc584c0
 which belongs to the cache kmalloc-1024 of size 1024
The buggy address is located 584 bytes inside of
 1024-byte region [ffff88809bc584c0, ffff88809bc588c0)
The buggy address belongs to the page:
page:ffffea00026f1600 count:1 mapcount:0 mapping:ffff88813bff0ac0 index:0x0 compound_mapcount: 0
flags: 0xfff00000008100(slab|head)
raw: 00fff00000008100 ffffea0002629a88 ffffea00026f0a08 ffff88813bff0ac0
raw: 0000000000000000 ffff88809bc58040 0000000100000007 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88809bc58600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88809bc58680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88809bc58700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                      ^
 ffff88809bc58780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88809bc58800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (275):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/06/28 10:18 linux-4.19.y 3f8a27f9e27b ef82eb2c .config console log report syz C ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2022/06/14 08:06 linux-4.19.y 3f8a27f9e27b 0f087040 .config console log report syz C ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2023/02/21 14:35 linux-4.19.y 3f8a27f9e27b f949448d .config console log report syz [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2022/07/28 20:44 linux-4.19.y 3f8a27f9e27b fb95c74d .config console log report syz ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2021/06/07 18:31 linux-4.19.y 1722257b8ece e59537be .config console log report syz ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2021/05/15 08:44 linux-4.19.y 3c8c23092588 8bdd5343 .config console log report syz ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2021/05/15 04:55 linux-4.19.y 3c8c23092588 8bdd5343 .config console log report syz ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2021/05/15 00:17 linux-4.19.y 3c8c23092588 8bdd5343 .config console log report syz ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2021/05/13 02:16 linux-4.19.y 3c8c23092588 ed7d41c5 .config console log report syz ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2020/02/22 09:06 linux-4.19.y 4fccc2503536 2ffa6679 .config console log report syz ci2-linux-4-19
2020/02/14 12:52 linux-4.19.y 357668399cf7 5d7b90f1 .config console log report syz ci2-linux-4-19
2020/02/04 04:56 linux-4.19.y 32ee7492f104 93e5e335 .config console log report syz ci2-linux-4-19
2020/01/25 04:04 linux-4.19.y d183c8e2647a 2e95ab33 .config console log report syz ci2-linux-4-19
2020/01/24 17:09 linux-4.19.y d183c8e2647a 2e95ab33 .config console log report syz ci2-linux-4-19
2020/01/24 16:35 linux-4.19.y d183c8e2647a 2e95ab33 .config console log report syz ci2-linux-4-19
2020/01/24 04:22 linux-4.19.y d183c8e2647a 11ebf937 .config console log report syz ci2-linux-4-19
2020/01/23 04:57 linux-4.19.y dc4ba5be1bab 3334d684 .config console log report syz ci2-linux-4-19
2020/01/22 15:17 linux-4.19.y dc4ba5be1bab 8eda0b95 .config console log report syz ci2-linux-4-19
2020/01/22 14:58 linux-4.19.y dc4ba5be1bab 8eda0b95 .config console log report syz ci2-linux-4-19
2020/01/21 23:56 linux-4.19.y dc4ba5be1bab 8eda0b95 .config console log report syz ci2-linux-4-19
2020/01/21 21:16 linux-4.19.y dc4ba5be1bab 8eda0b95 .config console log report syz ci2-linux-4-19
2020/01/18 13:23 linux-4.19.y dc4ba5be1bab 3de7aabb .config console log report syz ci2-linux-4-19
2020/01/18 10:48 linux-4.19.y dc4ba5be1bab 3de7aabb .config console log report syz ci2-linux-4-19
2020/01/18 09:44 linux-4.19.y dc4ba5be1bab 3de7aabb .config console log report syz ci2-linux-4-19
2020/01/17 16:50 linux-4.19.y db5b9190ff82 3de7aabb .config console log report syz ci2-linux-4-19
2020/01/17 16:12 linux-4.19.y db5b9190ff82 3de7aabb .config console log report syz ci2-linux-4-19
2020/01/17 12:56 linux-4.19.y db5b9190ff82 3de7aabb .config console log report syz ci2-linux-4-19
2020/01/17 09:57 linux-4.19.y db5b9190ff82 3de7aabb .config console log report syz ci2-linux-4-19
2020/01/17 08:39 linux-4.19.y db5b9190ff82 3de7aabb .config console log report syz ci2-linux-4-19
2020/01/17 06:37 linux-4.19.y db5b9190ff82 3de7aabb .config console log report syz ci2-linux-4-19
2019/11/25 01:22 linux-4.19.y 14260788bbb9 598ca6c8 .config console log report syz ci2-linux-4-19
2019/10/12 02:15 linux-4.19.y dafd634415a7 426631dd .config console log report syz ci2-linux-4-19
2019/09/05 11:30 linux-4.19.y 97ab07e11fbf 040fda58 .config console log report syz ci2-linux-4-19
2019/09/03 10:52 linux-4.19.y 97ab07e11fbf 14544a56 .config console log report syz ci2-linux-4-19
2019/08/30 03:25 linux-4.19.y 97ab07e11fbf cd626f3b .config console log report syz ci2-linux-4-19
2019/08/20 11:18 linux-4.19.y a5aa80588fcd cfc9868f .config console log report syz ci2-linux-4-19
2019/08/16 13:32 linux-4.19.y a5aa80588fcd 8fd428a1 .config console log report syz ci2-linux-4-19
2019/08/07 20:10 linux-4.19.y cc4c818b2219 e6ebef88 .config console log report syz ci2-linux-4-19
2019/08/07 06:26 linux-4.19.y cc4c818b2219 cdde7486 .config console log report syz ci2-linux-4-19
2019/08/03 17:25 linux-4.19.y 9a9de33a9dfa 6affd8e8 .config console log report syz ci2-linux-4-19
2019/08/03 03:04 linux-4.19.y 9a9de33a9dfa 3faab807 .config console log report syz ci2-linux-4-19
2019/07/31 09:31 linux-4.19.y 9a9de33a9dfa 7c7ded69 .config console log report syz ci2-linux-4-19
2019/07/27 20:41 linux-4.19.y 7250956f6eaf c85e1c5b .config console log report syz ci2-linux-4-19
2019/05/18 22:27 linux-4.19.y dafc674bbcb1 5a4461b0 .config console log report syz ci2-linux-4-19
2023/03/04 13:41 linux-4.19.y 3f8a27f9e27b f8902b57 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2023/02/27 09:57 linux-4.19.y 3f8a27f9e27b 9189cb53 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2023/02/25 20:36 linux-4.19.y 3f8a27f9e27b ee50e71c .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2023/02/15 15:23 linux-4.19.y 3f8a27f9e27b 6be0f1f5 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2023/02/12 15:11 linux-4.19.y 3f8a27f9e27b 93e26d60 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2023/02/09 21:45 linux-4.19.y 3f8a27f9e27b 07980f9d .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2023/02/07 19:38 linux-4.19.y 3f8a27f9e27b 15c3d445 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2023/02/06 16:05 linux-4.19.y 3f8a27f9e27b 0a9c11b6 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2023/02/05 13:44 linux-4.19.y 3f8a27f9e27b be607b78 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2023/02/03 23:25 linux-4.19.y 3f8a27f9e27b 1b2f701a .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2023/02/03 16:06 linux-4.19.y 3f8a27f9e27b 1b2f701a .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2023/02/03 07:47 linux-4.19.y 3f8a27f9e27b 33fc5c09 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2023/01/26 17:21 linux-4.19.y 3f8a27f9e27b 9dfcf09c .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2023/01/24 19:32 linux-4.19.y 3f8a27f9e27b 9dfcf09c .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2023/01/11 07:56 linux-4.19.y 3f8a27f9e27b 48bc529a .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2022/12/24 08:24 linux-4.19.y 3f8a27f9e27b 9da18ae8 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2022/12/12 22:10 linux-4.19.y 3f8a27f9e27b 67be1ae7 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2022/12/02 08:20 linux-4.19.y 3f8a27f9e27b e080de16 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2022/11/28 07:45 linux-4.19.y 3f8a27f9e27b f4470a7b .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2022/11/26 03:52 linux-4.19.y 3f8a27f9e27b f4470a7b .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2022/11/24 20:11 linux-4.19.y 3f8a27f9e27b ff68ff8f .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2022/11/14 11:53 linux-4.19.y 3f8a27f9e27b 943f4cb8 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2022/11/13 14:24 linux-4.19.y 3f8a27f9e27b f42ee5d8 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2022/11/12 14:00 linux-4.19.y 3f8a27f9e27b f42ee5d8 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2022/11/11 00:10 linux-4.19.y 3f8a27f9e27b 3ead01ad .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2022/11/03 21:17 linux-4.19.y 3f8a27f9e27b 6d752409 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2022/11/01 18:00 linux-4.19.y 3f8a27f9e27b a1d8560a .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2022/10/30 17:36 linux-4.19.y 3f8a27f9e27b 2a71366b .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2022/10/25 05:47 linux-4.19.y 3f8a27f9e27b 45645420 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2022/10/18 00:04 linux-4.19.y 3f8a27f9e27b 94744d21 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2022/10/13 16:52 linux-4.19.y 3f8a27f9e27b adf90437 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2022/10/09 18:34 linux-4.19.y 3f8a27f9e27b aea5da89 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2022/10/06 10:28 linux-4.19.y 3f8a27f9e27b 2c6543ad .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2022/09/25 10:54 linux-4.19.y 3f8a27f9e27b 0042f2b4 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2022/09/17 01:53 linux-4.19.y 3f8a27f9e27b dd9a85ff .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2022/09/10 20:35 linux-4.19.y 3f8a27f9e27b 356d8217 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2022/09/10 12:35 linux-4.19.y 3f8a27f9e27b 356d8217 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2022/08/30 10:53 linux-4.19.y 3f8a27f9e27b 4a380809 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2022/08/15 11:46 linux-4.19.y 3f8a27f9e27b 8dfcaa3d .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2022/07/29 22:47 linux-4.19.y 3f8a27f9e27b fef302b1 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2022/07/27 19:48 linux-4.19.y 3f8a27f9e27b da9d0366 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2022/07/25 03:15 linux-4.19.y 3f8a27f9e27b 22343af4 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2022/07/21 16:08 linux-4.19.y 3f8a27f9e27b 6e67af9d .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2022/07/15 19:43 linux-4.19.y 3f8a27f9e27b 5d921b08 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2022/07/14 20:20 linux-4.19.y 3f8a27f9e27b 5d921b08 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in psock_map_pop
2020/12/20 21:45 linux-4.19.y 13d2ce42de8c 04201c06 .config console log report info ci2-linux-4-19
* Struck through repros no longer work on HEAD.