syzbot


KASAN: use-after-free Read in sk_psock_verdict_data_ready

Status: auto-obsoleted due to no activity on 2024/11/26 04:55
Reported-by: syzbot+adeaaeac87c027191309@syzkaller.appspotmail.com
First crash: 125d, last: 125d
Similar bugs (8)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-15 KASAN: use-after-free Read in sk_psock_verdict_data_ready 12 9d23h 109d 0/2 premoderation: reported on 2024/09/02 22:21
android-6-1 KASAN: use-after-free Read in sk_psock_verdict_data_ready 2 41d 74d 0/2 premoderation: reported on 2024/10/08 03:06
upstream general protection fault in sk_psock_verdict_data_ready net 2 564d 569d 0/28 auto-obsoleted due to no activity on 2023/09/14 09:29
upstream KASAN: slab-use-after-free Read in sk_psock_verdict_data_ready (2) bpf net 2 12d 38d 0/28 upstream: reported on 2024/11/13 15:05
upstream BUG: unable to handle kernel NULL pointer dereference in sk_psock_verdict_data_ready net bpf C unreliable 15 293d 413d 25/28 fixed on 2024/04/02 10:57
upstream KASAN: slab-use-after-free Read in sk_psock_verdict_data_ready bpf net 1 202d 198d 0/28 auto-obsoleted due to no activity on 2024/08/31 11:03
android-6-1 BUG: unable to handle kernel NULL pointer dereference in sk_psock_verdict_data_ready origin:upstream missing-backport C 204 175d 312d 0/2 auto-obsoleted due to no activity on 2024/09/07 14:49
linux-6.1 BUG: unable to handle kernel NULL pointer dereference in sk_psock_verdict_data_ready origin:upstream C done 1 311d 311d 3/3 fixed on 2024/03/18 12:46

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in sk_psock_verdict_data_ready+0xc2/0x1a0 net/core/skmsg.c:1212
Read of size 8 at addr ffff888076bfe620 by task syz.3.119/4031

CPU: 0 PID: 4031 Comm: syz.3.119 Not tainted 5.15.164-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106
 print_address_description+0x63/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
 sk_psock_verdict_data_ready+0xc2/0x1a0 net/core/skmsg.c:1212
 unix_stream_sendmsg+0x8fd/0x1070 net/unix/af_unix.c:2106
 sock_sendmsg_nosec net/socket.c:704 [inline]
 __sock_sendmsg net/socket.c:716 [inline]
 ____sys_sendmsg+0x59e/0x8f0 net/socket.c:2431
 ___sys_sendmsg+0x252/0x2e0 net/socket.c:2485
 __sys_sendmsg net/socket.c:2514 [inline]
 __do_sys_sendmsg net/socket.c:2523 [inline]
 __se_sys_sendmsg+0x19a/0x260 net/socket.c:2521
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7f6118853e79
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f6116c8e038 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007f61189f0130 RCX: 00007f6118853e79
RDX: 0000000000000000 RSI: 0000000020000500 RDI: 0000000000000007
RBP: 00007f61188c1916 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f61189f0130 R15: 00007ffdcf109678
 </TASK>

Allocated by task 4031:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:434 [inline]
 __kasan_slab_alloc+0x8e/0xc0 mm/kasan/common.c:467
 kasan_slab_alloc include/linux/kasan.h:254 [inline]
 slab_post_alloc_hook+0x53/0x380 mm/slab.h:519
 slab_alloc_node mm/slub.c:3220 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 kmem_cache_alloc+0xf3/0x280 mm/slub.c:3233
 sock_alloc_inode+0x17/0xb0 net/socket.c:303
 alloc_inode fs/inode.c:236 [inline]
 new_inode_pseudo+0x60/0x210 fs/inode.c:937
 sock_alloc net/socket.c:626 [inline]
 __sock_create+0x11f/0x8d0 net/socket.c:1450
 sock_create net/socket.c:1537 [inline]
 __sys_socketpair+0x2c1/0x700 net/socket.c:1637
 __do_sys_socketpair net/socket.c:1690 [inline]
 __se_sys_socketpair net/socket.c:1687 [inline]
 __x64_sys_socketpair+0x97/0xb0 net/socket.c:1687
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Freed by task 20:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x80 mm/kasan/common.c:46
 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360
 ____kasan_slab_free+0xd8/0x120 mm/kasan/common.c:366
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:1705 [inline]
 slab_free_freelist_hook+0xdd/0x160 mm/slub.c:1731
 slab_free mm/slub.c:3499 [inline]
 kmem_cache_free+0x91/0x1f0 mm/slub.c:3515
 rcu_do_batch kernel/rcu/tree.c:2523 [inline]
 rcu_core+0xa15/0x1650 kernel/rcu/tree.c:2763
 handle_softirqs+0x3a7/0x930 kernel/softirq.c:558
 run_ksoftirqd+0xc6/0x120 kernel/softirq.c:925
 smpboot_thread_fn+0x51b/0x9d0 kernel/smpboot.c:164
 kthread+0x3f6/0x4f0 kernel/kthread.c:334
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

Last potentially related work creation:
 kasan_save_stack+0x36/0x60 mm/kasan/common.c:38
 kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348
 __call_rcu kernel/rcu/tree.c:3007 [inline]
 call_rcu+0x1c4/0xa70 kernel/rcu/tree.c:3087
 __dentry_kill+0x436/0x650 fs/dcache.c:586
 dentry_kill+0xbb/0x290
 dput+0xd8/0x1a0 fs/dcache.c:893
 __fput+0x636/0x8e0 fs/file_table.c:288
 task_work_run+0x129/0x1a0 kernel/task_work.c:164
 tracehook_notify_resume include/linux/tracehook.h:189 [inline]
 exit_to_user_mode_loop+0x106/0x130 kernel/entry/common.c:181
 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:214
 __syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline]
 syscall_exit_to_user_mode+0x5d/0x240 kernel/entry/common.c:307
 do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Second to last potentially related work creation:
 kasan_save_stack+0x36/0x60 mm/kasan/common.c:38
 kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348
 __call_rcu kernel/rcu/tree.c:3007 [inline]
 call_rcu+0x1c4/0xa70 kernel/rcu/tree.c:3087
 __dentry_kill+0x436/0x650 fs/dcache.c:586
 dentry_kill+0xbb/0x290
 dput+0xd8/0x1a0 fs/dcache.c:893
 __fput+0x636/0x8e0 fs/file_table.c:288
 task_work_run+0x129/0x1a0 kernel/task_work.c:164
 tracehook_notify_resume include/linux/tracehook.h:189 [inline]
 exit_to_user_mode_loop+0x106/0x130 kernel/entry/common.c:181
 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:214
 __syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline]
 syscall_exit_to_user_mode+0x5d/0x240 kernel/entry/common.c:307
 do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

The buggy address belongs to the object at ffff888076bfe600
 which belongs to the cache sock_inode_cache of size 1408
The buggy address is located 32 bytes inside of
 1408-byte region [ffff888076bfe600, ffff888076bfeb80)
The buggy address belongs to the page:
page:ffffea0001dafe00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888076bfc800 pfn:0x76bf8
head:ffffea0001dafe00 order:3 compound_mapcount:0 compound_pincount:0
memcg:ffff888023578901
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea0001891200 0000000500000005 ffff888016be4500
raw: ffff888076bfc800 0000000080150013 00000001ffffffff ffff888023578901
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Reclaimable, gfp_mask 0xd20d0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_RECLAIMABLE), pid 3241, ts 24480113734, free_ts 10607067521
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x322a/0x33c0 mm/page_alloc.c:4159
 __alloc_pages+0x272/0x700 mm/page_alloc.c:5423
 alloc_slab_page mm/slub.c:1775 [inline]
 allocate_slab mm/slub.c:1912 [inline]
 new_slab+0xbb/0x4b0 mm/slub.c:1975
 ___slab_alloc+0x6f6/0xe10 mm/slub.c:3008
 __slab_alloc mm/slub.c:3095 [inline]
 slab_alloc_node mm/slub.c:3186 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 kmem_cache_alloc+0x18e/0x280 mm/slub.c:3233
 sock_alloc_inode+0x17/0xb0 net/socket.c:303
 alloc_inode fs/inode.c:236 [inline]
 new_inode_pseudo+0x60/0x210 fs/inode.c:937
 sock_alloc net/socket.c:626 [inline]
 __sock_create+0x11f/0x8d0 net/socket.c:1450
 sock_create net/socket.c:1537 [inline]
 __sys_socketpair+0x335/0x700 net/socket.c:1641
 __do_sys_socketpair net/socket.c:1690 [inline]
 __se_sys_socketpair net/socket.c:1687 [inline]
 __x64_sys_socketpair+0x97/0xb0 net/socket.c:1687
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1340 [inline]
 free_pcp_prepare mm/page_alloc.c:1391 [inline]
 free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317
 free_unref_page+0x95/0x2d0 mm/page_alloc.c:3396
 free_contig_range+0x95/0xf0 mm/page_alloc.c:9342
 destroy_args+0xfe/0x980 mm/debug_vm_pgtable.c:1018
 debug_vm_pgtable+0x40d/0x470 mm/debug_vm_pgtable.c:1331
 do_one_initcall+0x22b/0x7a0 init/main.c:1302
 do_initcall_level+0x157/0x210 init/main.c:1375
 do_initcalls+0x49/0x90 init/main.c:1391
 kernel_init_freeable+0x425/0x5c0 init/main.c:1615
 kernel_init+0x19/0x290 init/main.c:1506
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

Memory state around the buggy address:
 ffff888076bfe500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888076bfe580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888076bfe600: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                               ^
 ffff888076bfe680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888076bfe700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/08/18 04:55 linux-5.15.y 7e89efd3ae1c dbc93b08 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in sk_psock_verdict_data_ready
* Struck through repros no longer work on HEAD.