syzbot


KASAN: use-after-free Read in unix_release_sock

Status: premoderation: reported on 2025/08/09 12:35
Reported-by: syzbot+094eceeac227bfd15ae9@syzkaller.appspotmail.com
First crash: 19d, last: 19d

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in unix_skb_len net/unix/af_unix.c:523 [inline]
BUG: KASAN: use-after-free in unix_release_sock+0xc54/0xca0 net/unix/af_unix.c:565
Read of size 4 at addr ffff88814edb9184 by task syz.5.3337/11607

CPU: 0 PID: 11607 Comm: syz.5.3337 Tainted: G        W         5.15.189-syzkaller-android13-5.15.189_r00 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
Call Trace:
 <TASK>
 __dump_stack+0x21/0x30 lib/dump_stack.c:88
 dump_stack_lvl+0xee/0x150 lib/dump_stack.c:106
 print_address_description+0x7f/0x2c0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:427 [inline]
 kasan_report+0xf1/0x140 mm/kasan/report.c:444
 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:308
 unix_skb_len net/unix/af_unix.c:523 [inline]
 unix_release_sock+0xc54/0xca0 net/unix/af_unix.c:565
 unix_release+0x8c/0xc0 net/unix/af_unix.c:948
 __sock_release net/socket.c:649 [inline]
 sock_close+0xe0/0x270 net/socket.c:1336
 __fput+0x20b/0x8b0 fs/file_table.c:311
 ____fput+0x15/0x20 fs/file_table.c:339
 task_work_run+0x127/0x190 kernel/task_work.c:188
 exit_task_work include/linux/task_work.h:33 [inline]
 do_exit+0xa7e/0x27a0 kernel/exit.c:889
 __do_sys_exit kernel/exit.c:972 [inline]
 __se_sys_exit kernel/exit.c:970 [inline]
 __x64_sys_exit+0x40/0x40 kernel/exit.c:970
 x64_sys_call+0x44/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:61
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7f9220d87be9
Code: Unable to access opcode bytes at RIP 0x7f9220d87bbf.
RSP: 002b:00007f921f7cefe8 EFLAGS: 00000246 ORIG_RAX: 000000000000003c
RAX: ffffffffffffffda RBX: 00007f9220faf090 RCX: 00007f9220d87be9
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 00007f9220e0ae19 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f9220faf128 R14: 00007f9220faf090 R15: 00007fff149c2d38
 </TASK>

Allocated by task 11595:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:45 [inline]
 set_alloc_info mm/kasan/common.c:433 [inline]
 __kasan_slab_alloc+0xbd/0xf0 mm/kasan/common.c:466
 kasan_slab_alloc include/linux/kasan.h:217 [inline]
 slab_post_alloc_hook+0x4f/0x2b0 mm/slab.h:550
 slab_alloc_node mm/slub.c:3240 [inline]
 slab_alloc mm/slub.c:3250 [inline]
 kmem_cache_alloc+0xf7/0x260 mm/slub.c:3255
 kmem_cache_alloc_node include/linux/slab.h:489 [inline]
 __alloc_skb+0xe0/0x740 net/core/skbuff.c:416
 alloc_skb include/linux/skbuff.h:1183 [inline]
 alloc_skb_with_frags+0xa8/0x620 net/core/skbuff.c:6194
 sock_alloc_send_pskb+0x853/0x980 net/core/sock.c:2537
 unix_stream_sendmsg+0x41b/0xc80 net/unix/af_unix.c:2084
 sock_sendmsg_nosec net/socket.c:704 [inline]
 __sock_sendmsg net/socket.c:716 [inline]
 ____sys_sendmsg+0x5a2/0x8c0 net/socket.c:2436
 ___sys_sendmsg+0x1f0/0x260 net/socket.c:2490
 __sys_sendmsg net/socket.c:2519 [inline]
 __do_sys_sendmsg net/socket.c:2528 [inline]
 __se_sys_sendmsg net/socket.c:2526 [inline]
 __x64_sys_sendmsg+0x1e2/0x2a0 net/socket.c:2526
 x64_sys_call+0x4b/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:47
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Freed by task 11595:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4a/0x70 mm/kasan/common.c:45
 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370
 ____kasan_slab_free+0x125/0x160 mm/kasan/common.c:365
 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:373
 kasan_slab_free include/linux/kasan.h:193 [inline]
 slab_free_hook mm/slub.c:1723 [inline]
 slab_free_freelist_hook+0xc2/0x190 mm/slub.c:1749
 slab_free mm/slub.c:3521 [inline]
 kmem_cache_free+0x100/0x320 mm/slub.c:3539
 kfree_skbmem+0x10c/0x180 net/core/skbuff.c:-1
 __kfree_skb net/core/skbuff.c:758 [inline]
 kfree_skb_reason net/core/skbuff.c:778 [inline]
 kfree_skb+0xc1/0x2f0 net/core/skbuff.c:792
 unix_read_sock+0x24a/0x2c0 net/unix/af_unix.c:2443
 unix_stream_read_sock+0x61/0x90 net/unix/af_unix.c:2606
 sk_psock_verdict_data_ready+0x115/0x170 net/core/skmsg.c:1245
 unix_stream_sendmsg+0x7c4/0xc80 net/unix/af_unix.c:2117
 sock_sendmsg_nosec net/socket.c:704 [inline]
 __sock_sendmsg net/socket.c:716 [inline]
 ____sys_sendmsg+0x5a2/0x8c0 net/socket.c:2436
 ___sys_sendmsg+0x1f0/0x260 net/socket.c:2490
 __sys_sendmsg net/socket.c:2519 [inline]
 __do_sys_sendmsg net/socket.c:2528 [inline]
 __se_sys_sendmsg net/socket.c:2526 [inline]
 __x64_sys_sendmsg+0x1e2/0x2a0 net/socket.c:2526
 x64_sys_call+0x4b/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:47
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

The buggy address belongs to the object at ffff88814edb9140
 which belongs to the cache skbuff_head_cache of size 248
The buggy address is located 68 bytes inside of
 248-byte region [ffff88814edb9140, ffff88814edb9238)
The buggy address belongs to the page:
page:ffffea00053b6e40 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x14edb9
flags: 0x4000000000000200(slab|zone=1)
raw: 4000000000000200 dead000000000100 dead000000000122 ffff8881081abc80
raw: 0000000000000000 00000000000c000c 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 8, ts 286532021659, free_ts 286518782950
 set_page_owner include/linux/page_owner.h:33 [inline]
 post_alloc_hook+0x192/0x1b0 mm/page_alloc.c:2605
 prep_new_page+0x1c/0x110 mm/page_alloc.c:2611
 get_page_from_freelist+0x2cc5/0x2d50 mm/page_alloc.c:4485
 __alloc_pages+0x18f/0x440 mm/page_alloc.c:5795
 alloc_slab_page mm/slub.c:-1 [inline]
 allocate_slab mm/slub.c:1932 [inline]
 new_slab+0xa1/0x4d0 mm/slub.c:1995
 ___slab_alloc+0x381/0x810 mm/slub.c:3028
 __slab_alloc+0x49/0x90 mm/slub.c:3115
 slab_alloc_node mm/slub.c:3206 [inline]
 slab_alloc mm/slub.c:3250 [inline]
 kmem_cache_alloc+0x138/0x260 mm/slub.c:3255
 kmem_cache_alloc_node include/linux/slab.h:489 [inline]
 __alloc_skb+0xe0/0x740 net/core/skbuff.c:416
 alloc_skb include/linux/skbuff.h:1183 [inline]
 nlmsg_new include/net/netlink.h:953 [inline]
 inet_netconf_notify_devconf+0x169/0x220 net/ipv4/devinet.c:2123
 __devinet_sysctl_unregister net/ipv4/devinet.c:2632 [inline]
 devinet_sysctl_unregister net/ipv4/devinet.c:2656 [inline]
 inetdev_destroy net/ipv4/devinet.c:327 [inline]
 inetdev_event+0x7c6/0x10a0 net/ipv4/devinet.c:1613
 notifier_call_chain kernel/notifier.c:83 [inline]
 raw_notifier_call_chain+0x90/0x100 kernel/notifier.c:391
 call_netdevice_notifiers_info net/core/dev.c:2057 [inline]
 call_netdevice_notifiers_extack net/core/dev.c:2069 [inline]
 call_netdevice_notifiers net/core/dev.c:2083 [inline]
 unregister_netdevice_many+0xfb8/0x1990 net/core/dev.c:11150
 ip_tunnel_delete_nets+0x343/0x390 net/ipv4/ip_tunnel.c:1137
 ipgre_exit_batch_net+0x22/0x30 net/ipv4/ip_gre.c:1039
 ops_exit_list net/core/net_namespace.c:177 [inline]
 cleanup_net+0x602/0xad0 net/core/net_namespace.c:599
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:26 [inline]
 free_pages_prepare mm/page_alloc.c:1472 [inline]
 free_pcp_prepare mm/page_alloc.c:1544 [inline]
 free_unref_page_prepare+0x542/0x550 mm/page_alloc.c:3534
 free_unref_page+0xa2/0x550 mm/page_alloc.c:3616
 free_the_page mm/page_alloc.c:805 [inline]
 __free_pages+0x6c/0x100 mm/page_alloc.c:5871
 __vunmap+0x84d/0x9e0 mm/vmalloc.c:2653
 __vfree mm/vmalloc.c:2702 [inline]
 vfree+0x8b/0xc0 mm/vmalloc.c:2733
 bpf_prog_calc_tag+0x5bc/0x6d0 kernel/bpf/core.c:337
 resolve_pseudo_ldimm64+0xd4/0x11d0 kernel/bpf/verifier.c:11803
 bpf_check+0x2c44/0xf330 kernel/bpf/verifier.c:14093
 bpf_prog_load+0x1042/0x1550 kernel/bpf/syscall.c:2328
 __sys_bpf+0x4c3/0x730 kernel/bpf/syscall.c:4633
 __do_sys_bpf kernel/bpf/syscall.c:4737 [inline]
 __se_sys_bpf kernel/bpf/syscall.c:4735 [inline]
 __x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:4735
 x64_sys_call+0x4b9/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:322
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Memory state around the buggy address:
 ffff88814edb9080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fc
 ffff88814edb9100: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb
>ffff88814edb9180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff88814edb9200: fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc fc
 ffff88814edb9280: fa 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
2025/08/09 12:34 android13-5.15-lts f32b52534f1d 32a0e5ed .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15-perf KASAN: use-after-free Read in unix_release_sock
* Struck through repros no longer work on HEAD.