syzbot


KASAN: use-after-free Read in sk_psock_verdict_data_ready

Status: premoderation: reported on 2024/10/08 03:06
Reported-by: syzbot+18dc0f3c9a42f503660b@syzkaller.appspotmail.com
First crash: 33d, last: 3h44m
Similar bugs (7)
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 8 15d 68d 0/2 premoderation: reported on 2024/09/02 22:21
linux-5.15 KASAN: use-after-free Read in sk_psock_verdict_data_ready 1 83d 83d 0/3 upstream: reported on 2024/08/18 04:55
upstream general protection fault in sk_psock_verdict_data_ready net 2 522d 527d 0/28 auto-obsoleted due to no activity on 2023/09/14 09:29
upstream BUG: unable to handle kernel NULL pointer dereference in sk_psock_verdict_data_ready net bpf C unreliable 15 252d 372d 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 160d 156d 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 133d 270d 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 269d 269d 3/3 fixed on 2024/03/18 12:46

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in sk_psock_verdict_data_ready+0x60/0x1b0 net/core/skmsg.c:1211
Read of size 8 at addr ffff888114abe960 by task syz.7.4455/14350

CPU: 0 PID: 14350 Comm: syz.7.4455 Not tainted 6.1.112-syzkaller-00005-geef3d33656ce #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:316 [inline]
 print_report+0x158/0x4e0 mm/kasan/report.c:427
 kasan_report+0x13c/0x170 mm/kasan/report.c:531
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:351
 sk_psock_verdict_data_ready+0x60/0x1b0 net/core/skmsg.c:1211
 unix_stream_sendmsg+0x8fd/0x1070 net/unix/af_unix.c:2224
 sock_sendmsg_nosec net/socket.c:716 [inline]
 __sock_sendmsg net/socket.c:728 [inline]
 ____sys_sendmsg+0x5d3/0x9a0 net/socket.c:2504
 ___sys_sendmsg net/socket.c:2558 [inline]
 __sys_sendmsg+0x2a9/0x390 net/socket.c:2587
 __do_sys_sendmsg net/socket.c:2596 [inline]
 __se_sys_sendmsg net/socket.c:2594 [inline]
 __x64_sys_sendmsg+0x7f/0x90 net/socket.c:2594
 x64_sys_call+0x16a/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:47
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7fb2ff17e719
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:00007fb2fff61038 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007fb2ff335f80 RCX: 00007fb2ff17e719
RDX: 0000000000000003 RSI: 0000000020000980 RDI: 0000000000000009
RBP: 00007fb2ff1f139e R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007fb2ff335f80 R15: 00007fff8c074c58
 </TASK>

Allocated by task 14350:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 kasan_save_alloc_info+0x1f/0x30 mm/kasan/generic.c:505
 __kasan_slab_alloc+0x6c/0x80 mm/kasan/common.c:333
 kasan_slab_alloc include/linux/kasan.h:202 [inline]
 slab_post_alloc_hook+0x53/0x2c0 mm/slab.h:768
 slab_alloc_node mm/slub.c:3421 [inline]
 slab_alloc mm/slub.c:3429 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3436 [inline]
 kmem_cache_alloc_lru+0x102/0x220 mm/slub.c:3452
 alloc_inode_sb include/linux/fs.h:3208 [inline]
 sock_alloc_inode+0x28/0xc0 net/socket.c:304
 alloc_inode fs/inode.c:261 [inline]
 new_inode_pseudo+0x65/0x1d0 fs/inode.c:1055
 sock_alloc net/socket.c:629 [inline]
 __sock_create+0x135/0x760 net/socket.c:1504
 sock_create net/socket.c:1591 [inline]
 __sys_socketpair+0x313/0x6e0 net/socket.c:1722
 __do_sys_socketpair net/socket.c:1771 [inline]
 __se_sys_socketpair net/socket.c:1768 [inline]
 __x64_sys_socketpair+0x9b/0xb0 net/socket.c:1768
 x64_sys_call+0x19b/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:54
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Freed by task 14364:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:516
 ____kasan_slab_free+0x131/0x180 mm/kasan/common.c:241
 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:249
 kasan_slab_free include/linux/kasan.h:178 [inline]
 slab_free_hook mm/slub.c:1745 [inline]
 slab_free_freelist_hook mm/slub.c:1771 [inline]
 slab_free mm/slub.c:3684 [inline]
 kmem_cache_free+0x291/0x510 mm/slub.c:3706
 sock_free_inode+0x20/0x30 net/socket.c:325
 i_callback+0x4b/0x70 fs/inode.c:250
 rcu_do_batch+0x552/0xbe0 kernel/rcu/tree.c:2297
 rcu_core+0x4ee/0xf10 kernel/rcu/tree.c:2557
 rcu_core_si+0x9/0x10 kernel/rcu/tree.c:2574
 handle_softirqs+0x1db/0x650 kernel/softirq.c:617
 __do_softirq kernel/softirq.c:655 [inline]
 invoke_softirq kernel/softirq.c:472 [inline]
 __irq_exit_rcu+0x52/0xf0 kernel/softirq.c:704
 irq_exit_rcu+0x9/0x10 kernel/softirq.c:716
 sysvec_apic_timer_interrupt+0x49/0xc0 arch/x86/kernel/apic/apic.c:1106
 asm_sysvec_apic_timer_interrupt+0x1b/0x20 arch/x86/include/asm/idtentry.h:653

Last potentially related work creation:
 kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45
 __kasan_record_aux_stack+0xb4/0xc0 mm/kasan/generic.c:486
 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:496
 __call_rcu_common kernel/rcu/tree.c:2807 [inline]
 call_rcu+0xdc/0x10f0 kernel/rcu/tree.c:2926
 destroy_inode fs/inode.c:316 [inline]
 evict+0x87d/0x930 fs/inode.c:716
 iput_final fs/inode.c:1826 [inline]
 iput+0x616/0x690 fs/inode.c:1852
 dentry_unlink_inode+0x34e/0x430 fs/dcache.c:405
 __dentry_kill+0x447/0x650 fs/dcache.c:611
 dentry_kill+0xc0/0x2a0
 dput+0x40/0x80 fs/dcache.c:918
 __fput+0x56c/0x870 fs/file_table.c:328
 ____fput+0x15/0x20 fs/file_table.c:348
 task_work_run+0x24d/0x2e0 kernel/task_work.c:203
 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
 exit_to_user_mode_loop+0x94/0xa0 kernel/entry/common.c:177
 exit_to_user_mode_prepare+0x5a/0xa0 kernel/entry/common.c:210
 __syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline]
 syscall_exit_to_user_mode+0x26/0x130 kernel/entry/common.c:303
 do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:87
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Second to last potentially related work creation:
 kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45
 __kasan_record_aux_stack+0xb4/0xc0 mm/kasan/generic.c:486
 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:496
 __call_rcu_common kernel/rcu/tree.c:2807 [inline]
 call_rcu+0xdc/0x10f0 kernel/rcu/tree.c:2926
 destroy_inode fs/inode.c:316 [inline]
 evict+0x87d/0x930 fs/inode.c:716
 iput_final fs/inode.c:1826 [inline]
 iput+0x616/0x690 fs/inode.c:1852
 dentry_unlink_inode+0x34e/0x430 fs/dcache.c:405
 __dentry_kill+0x447/0x650 fs/dcache.c:611
 dentry_kill+0xc0/0x2a0
 dput+0x40/0x80 fs/dcache.c:918
 __fput+0x56c/0x870 fs/file_table.c:328
 ____fput+0x15/0x20 fs/file_table.c:348
 task_work_run+0x24d/0x2e0 kernel/task_work.c:203
 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
 exit_to_user_mode_loop+0x94/0xa0 kernel/entry/common.c:177
 exit_to_user_mode_prepare+0x5a/0xa0 kernel/entry/common.c:210
 __syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline]
 syscall_exit_to_user_mode+0x26/0x130 kernel/entry/common.c:303
 do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:87
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

The buggy address belongs to the object at ffff888114abe940
 which belongs to the cache sock_inode_cache of size 832
The buggy address is located 32 bytes inside of
 832-byte region [ffff888114abe940, ffff888114abec80)

The buggy address belongs to the physical page:
page:ffffea000452af00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888114abc3c0 pfn:0x114abc
head:ffffea000452af00 order:2 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head|zone=1)
raw: 4000000000010200 ffffea00042f7b00 dead000000000003 ffff8881002ba780
raw: ffff888114abc3c0 000000008011000f 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 2, migratetype Reclaimable, gfp_mask 0x1d20d0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL|__GFP_RECLAIMABLE), pid 8421, tgid 8420 (syz.1.2570), ts 352982637985, free_ts 339369545051
 set_page_owner include/linux/page_owner.h:33 [inline]
 post_alloc_hook+0x213/0x220 mm/page_alloc.c:2590
 prep_new_page+0x1b/0x110 mm/page_alloc.c:2597
 get_page_from_freelist+0x2980/0x2a10 mm/page_alloc.c:4439
 __alloc_pages+0x234/0x610 mm/page_alloc.c:5728
 alloc_slab_page+0x6c/0xf0
 allocate_slab mm/slub.c:1962 [inline]
 new_slab+0x90/0x3e0 mm/slub.c:2015
 ___slab_alloc+0x6f9/0xb80 mm/slub.c:3203
 __slab_alloc+0x5d/0xa0 mm/slub.c:3302
 slab_alloc_node mm/slub.c:3387 [inline]
 slab_alloc mm/slub.c:3429 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3436 [inline]
 kmem_cache_alloc_lru+0x144/0x220 mm/slub.c:3452
 alloc_inode_sb include/linux/fs.h:3208 [inline]
 sock_alloc_inode+0x28/0xc0 net/socket.c:304
 alloc_inode fs/inode.c:261 [inline]
 new_inode_pseudo+0x65/0x1d0 fs/inode.c:1055
 sock_alloc net/socket.c:629 [inline]
 __sock_create+0x135/0x760 net/socket.c:1504
 sock_create_kern+0x3b/0x50 net/socket.c:1609
 inet_ctl_sock_create+0xbe/0x200 net/ipv4/af_inet.c:1676
 ndisc_net_init+0xa3/0x280 net/ipv6/ndisc.c:1989
 ops_init+0x1cd/0x480 net/core/net_namespace.c:138
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:26 [inline]
 free_pages_prepare mm/page_alloc.c:1498 [inline]
 free_pcp_prepare mm/page_alloc.c:1572 [inline]
 free_unref_page_prepare+0x83d/0x850 mm/page_alloc.c:3511
 free_unref_page+0xb2/0x5c0 mm/page_alloc.c:3607
 free_the_page mm/page_alloc.c:798 [inline]
 __free_pages+0x61/0xf0 mm/page_alloc.c:5817
 __free_slab+0xce/0x1a0 mm/slub.c:2039
 free_slab mm/slub.c:2054 [inline]
 discard_slab mm/slub.c:2060 [inline]
 __unfreeze_partials+0x165/0x1a0 mm/slub.c:2609
 put_cpu_partial+0xa9/0x100 mm/slub.c:2685
 __slab_free+0x1c8/0x280 mm/slub.c:3561
 do_slab_free mm/slub.c:3638 [inline]
 ___cache_free+0xc6/0xd0 mm/slub.c:3691
 qlink_free mm/kasan/quarantine.c:168 [inline]
 qlist_free_all+0xc5/0x140 mm/kasan/quarantine.c:187
 kasan_quarantine_reduce+0x15a/0x180 mm/kasan/quarantine.c:294
 __kasan_slab_alloc+0x24/0x80 mm/kasan/common.c:310
 kasan_slab_alloc include/linux/kasan.h:202 [inline]
 slab_post_alloc_hook+0x53/0x2c0 mm/slab.h:768
 slab_alloc_node mm/slub.c:3421 [inline]
 slab_alloc mm/slub.c:3429 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3436 [inline]
 kmem_cache_alloc+0x175/0x2c0 mm/slub.c:3445
 getname_flags+0xba/0x520 fs/namei.c:139
 getname fs/namei.c:218 [inline]
 __do_sys_unlink fs/namei.c:4439 [inline]
 __se_sys_unlink fs/namei.c:4437 [inline]
 __x64_sys_unlink+0x3c/0x50 fs/namei.c:4437
 x64_sys_call+0x289/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:88

Memory state around the buggy address:
 ffff888114abe800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff888114abe880: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
>ffff888114abe900: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb
                                                       ^
 ffff888114abe980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888114abea00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/11/10 01:01 android14-6.1 eef3d33656ce 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-6-1-perf KASAN: use-after-free Read in sk_psock_verdict_data_ready
2024/10/08 03:05 android14-6.1 0e8b65e41ffd d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-6-1-perf KASAN: use-after-free Read in sk_psock_verdict_data_ready
* Struck through repros no longer work on HEAD.